• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Hacking PDFs [slightly OT]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hacking PDFs [slightly OT]


  • Subject: Re: Hacking PDFs [slightly OT]
  • From: Hugi Thordarson <email@hidden>
  • Date: Tue, 22 Jul 2014 10:59:44 +0000

Hi Markus.

I haven’t worked with copy restricted documents, but I use PDFBox to open and work with password protected documents. At first glance it looks like it might work for you ( http://stackoverflow.com/questions/14700241/remove-encryption-from-pdf-with-pdfbox-like-qpdf ). PDFBox also comes with a nice little utility class for merging PDFs, here’s an example of how to use it. Although I suspect you’ll have to preprocess the documents (removing access restrictions) before using the PDFMergerUtility.


public WOActionResults multipleInvoiceResponse() {
PDFMergerUtility list = new PDFMergerUtility();
list.addSource( new ByteArrayInputStream( pdfDocument1ByteArray ) );
list.addSource( new ByteArrayInputStream( pdfDocument2ByteArray ) );
list.addSource( /* etc… */ );

ByteArrayOutputStream out = new ByteArrayOutputStream();
list.setDestinationStream( out );

try {
list.mergeDocuments();
}
catch( COSVisitorException | IOException e ) {
throw new RuntimeException( "An exception occurred while attempting to merge multiple invoices”, e );
}

return USHTTPUtilities.responseWithDataAndMimeType( “invoices.pdf", out.toByteArray(), "application/pdf" );
}

Cheers,
- hugi



On 22.7.2014, at 10:40, Theodore Petrosky <email@hidden> wrote:


what framework are you using to create these pdfs? I am using ERJasperReports (my own version to update to the newest JR). I will check again, but this was not difficult in jasperreports. It has a few bugaboos, but nothing insurmountable.



On Jul 22, 2014, at 5:59 AM, Markus Ruggiero <email@hidden> wrote:

Folks,

I have a large D2W application that generates tons of product spec sheets as PDF. The customer requires that all the PDFs are copy restricted (no copy allowed, just view and print). That all works. 

Now the customer has the idea that I should bundle all the generated PDFs into one large PDF. I can do that, no problem. BUT (there is always one, isn't there?) there are externally created PDFs (also copy restricted) that I need to include into the compound PDF. Those 3rd party PDFs are out of my control. I suggested to bundle the PDFs into a ZIP archive but the customer wants ONE large PDF. No, they don't care about inconsistent page numbering, they just want ONE PDF with 150+ pages and one cover page with internal links to the embedded documents.

Here is my problem: I have no idea how to do this. All the code I have found cannot deal with protected PDFs (and I have no way to unprotect them easily). The customer is even willing to accept something that can circumvent the protection. The only way I know of to get rid of the restriction is by opening the PDF in ColorSync on the Mac and then print to pdf. However the production app runs on Solaris, there is no Mac around. I might be able to talks the customer into buying a Mac just for this kind of processing. But this is really really last resort.

Any ideas? Any PDF guru out there?
Thanks for any help, I urgently need it.

---markus---



Markus Ruggiero
email@hidden
Check out the new book about Project Wonder and WebObjects on http://learningthewonders.com/






Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Hacking PDFs [slightly OT] (From: Markus Ruggiero <email@hidden>)
 >Re: Hacking PDFs [slightly OT] (From: Theodore Petrosky <email@hidden>)

  • Prev by Date: Re: Hacking PDFs [slightly OT]
  • Next by Date: app closing method
  • Previous by thread: Re: Hacking PDFs [slightly OT]
  • Next by thread: Re: Hacking PDFs [slightly OT]
  • Index(es):
    • Date
    • Thread