mustang/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java
public void extractLowLevel(InputStream pdfStream) throws IOException  {
		PDDocument doc = null;
		try {
			doc = PDDocument.load(pdfStream);
//			PDDocumentInformation info = doc.getDocumentInformation();
			PDDocumentNameDictionary names = new PDDocumentNameDictionary(
					doc.getDocumentCatalog());
			PDEmbeddedFilesNameTreeNode etn;
			etn = names.getEmbeddedFiles();
			if (etn==null)  {
				doc.close();
				return;
			}
			Map<String, COSObjectable> efMap = etn.getNames();
			// String filePath = "/tmp/";
			for (String filename : efMap.keySet()) {
				/**
				 * currently (in the release candidate of version 1) only one
				 * attached file with the name ZUGFeRD-invoice.xml is allowed
				 * */
				if (filename.equals("ZUGFeRD-invoice.xml")) { //$NON-NLS-1$
					containsMeta = true;

					PDComplexFileSpecification fileSpec = (PDComplexFileSpecification) efMap
							.get(filename);
					PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile();
					// String embeddedFilename = filePath + filename;
					// File file = new File(filePath + filename);
					// System.out.println("Writing " + embeddedFilename);
					// ByteArrayOutputStream fileBytes=new
					// ByteArrayOutputStream();
					// FileOutputStream fos = new FileOutputStream(file);
					rawXML = embeddedFile.getByteArray();
					setMeta(new String(rawXML));
					// fos.write(embeddedFile.getByteArray());
					// fos.close();
				}
			}

		} catch (IOException e1) {
			throw e1;
		}
		finally {
			try {
				if(doc!=null) {
					doc.close();
				}
			} catch (IOException e) {}
		}

	}
/**
	 * Extracts a ZUGFeRD invoice from a PDF document represented by an input stream.
	 * Errors are reported via exception handling.
	 */
Extracts a ZUGFeRD invoice from a PDF document represented by an input stream.
Errors are reported via exception handling.
Extracts a ZUGFeRD invoice from a PDF document represented by an input stream . Errors are reported via exception handling .
public void extractLowLevel(InputStream pdfStream) throws IOException  {
		PDDocument doc = null;
		try {
			doc = PDDocument.load(pdfStream);
			PDDocumentNameDictionary names = new PDDocumentNameDictionary(
					doc.getDocumentCatalog());
			PDEmbeddedFilesNameTreeNode etn;
			etn = names.getEmbeddedFiles();
			if (etn==null)  {
				doc.close();
				return;
			}
			Map<String, COSObjectable> efMap = etn.getNames();
			for (String filename : efMap.keySet()) {
				/**
				 * currently (in the release candidate of version 1) only one
				 * attached file with the name ZUGFeRD-invoice.xml is allowed
				 * */
				if (filename.equals("ZUGFeRD-invoice.xml")) { 
					containsMeta = true;
					PDComplexFileSpecification fileSpec = (PDComplexFileSpecification) efMap
							.get(filename);
					PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile();
					rawXML = embeddedFile.getByteArray();
					setMeta(new String(rawXML));
				}
			}
		} catch (IOException e1) {
			throw e1;
		}
		finally {
			try {
				if(doc!=null) {
					doc.close();
				}
			} catch (IOException e) {}
		}
	}
public void extractLowLevel ( InputStream pdfStream ) throws IOException { PDDocument doc = null ; try { doc = PDDocument . load ( pdfStream ) ; PDDocumentNameDictionary names = new PDDocumentNameDictionary ( doc . getDocumentCatalog ( ) ) ; PDEmbeddedFilesNameTreeNode etn ; etn = names . getEmbeddedFiles ( ) ; if ( etn == null ) { doc . close ( ) ; return ; } Map < String , COSObjectable > efMap = etn . getNames ( ) ; for ( String filename : efMap . keySet ( ) ) { /**
				 * currently (in the release candidate of version 1) only one
				 * attached file with the name ZUGFeRD-invoice.xml is allowed
				 * */ if ( filename . equals ( "ZUGFeRD-invoice.xml" ) ) { containsMeta = true ; PDComplexFileSpecification fileSpec = ( PDComplexFileSpecification ) efMap . get ( filename ) ; PDEmbeddedFile embeddedFile = fileSpec . getEmbeddedFile ( ) ; rawXML = embeddedFile . getByteArray ( ) ; setMeta ( new String ( rawXML ) ) ; } } } catch ( IOException e1 ) { throw e1 ; } finally { try { if ( doc != null ) { doc . close ( ) ; } } catch ( IOException e ) { } } }
Extracts a ZUGFeRD invoice from a PDF document represented by an input stream.
Extracts a ZUGFeRD invoice from a PDF document represented by an input stream .
//			PDDocumentInformation info = doc.getDocumentInformation();
 // String filePath = "/tmp/";
 //$NON-NLS-1$
 // String embeddedFilename = filePath + filename;
 // File file = new File(filePath + filename);
 // System.out.println("Writing " + embeddedFilename);
 // ByteArrayOutputStream fileBytes=new
 // ByteArrayOutputStream();
 // FileOutputStream fos = new FileOutputStream(file);
 // fos.write(embeddedFile.getByteArray());
 // fos.close();
