1

For my work, I need to translate pdf document into Image with PDFBox.

PDDocument document = PDDocument.load(new File(fileUrl));
PDFRenderer pdfRenderer=new PDFRenderer(document);
BufferedImage bim=pdfRenderer.renderImageWithDPI(page, dpi.floatValue());

My document have many optional content group that are not visible (with Acrobat Reader for example) but after rendering my image contains this ocg.

How render pdf document without render all ocg ?

Guyard
  • 29
  • 5
  • This is not supported by PDFBox at this time. One user did post some code the user mailing list, it can be found here: https://mail-archives.apache.org/mod_mbox/pdfbox-users/201606.mbox/thread See the thread "Suppressing layers on output". – Tilman Hausherr Jun 01 '17 at 16:55
  • Thank's for your help, i will study the question soon as possible. – Guyard Jun 02 '17 at 15:39
  • I have resolved my problem, the mailing list code works quite good! Do you have an idea when or why this functionality are not implemented in PDFBOX, one years after ? Do you think that there will be develloped in futur version ? It's in project ?. Thank's Ronald Guyard – Guyard Jun 13 '17 at 09:59
  • That code hasn't been put into the repository because there was disagreement about that strategy. The code and the discussion around it (see the thread) isn't forgotten, but there's no work on it at this time. – Tilman Hausherr Jun 15 '17 at 09:26
  • @TilmanHausherr : I have the same problem with LayerUtility for importing a page with optionnal content group as a PDFormObject. PDFormObject content unvisible ocg. Do you have a idea to solve this problem ? – Guyard Jun 27 '17 at 10:34
  • sorry, no, I don't know. – Tilman Hausherr Jun 27 '17 at 10:37

0 Answers0