You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2008/08/04 20:28:44 UTC

[jira] Created: (PDFBOX-362) ZipException occuring upon importing a page

ZipException occuring upon importing a page
-------------------------------------------

                 Key: PDFBOX-362
                 URL: https://issues.apache.org/jira/browse/PDFBOX-362
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel
            Reporter: Jukka Zitting


[Issue from SourceForge]
http://sourceforge.net/tracker/index.php?func=detail&aid=2019925&group_id=78314&atid=552832

copying page from source document to other doc, if the source page has
content, a ZipException occurs.

the following sample code exhibits the problem with such source pdf:

public class LoadSaveSample
{
/**
* @param args holds the name of a file to copy
* @throws IOException
* @throws COSVisitorException
*/
public static void main (String [] args)
throws IOException, COSVisitorException
{
String name = args [0];
File file = new File (name);
System.out.println ("loading file " + file.getPath ());
PDDocument doc = PDDocument.load (file);

ClassLoader loader = doc.getClass ().getClassLoader ();
System.out.println ("loader: " + loader);
try
{
PDDocument doc2 = new PDDocument ();
List all = doc.getDocumentCatalog ().getAllPages ();
Iterator it = all.iterator ();
while (true == it.hasNext ())
{
PDPage page = (PDPage)it.next ();
// now do the copy through import...
PDPage imported = doc2.importPage (page);
imported.setCropBox (page.findCropBox ());
imported.setMediaBox (page.findMediaBox ());
imported.setResources (page.findResources ());
imported.setRotation (page.findRotation ());
}
String outName = file.getPath () + ".saved.pdf";
doc2.save (outName);
System.out.println ("saved as " + outName);
}
finally
{
doc.close ();
}
}
}

http://sourceforge.net/tracker/download.php?group_id=78314&atid=552832&file_id=284963&aid=2019925

[Comment on SourceForge]
Date: 2008-07-16 20:07
Sender: nobody
Logged In: NO 

apologies: it should read:

copying page from source document to other doc, if the source page has NO
content, a ZipException occurs.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.