You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "vanja K." <va...@storagemadeeasy.com> on 2015/03/25 09:56:38 UTC

convert pdf page to image problem



I   use  pdfbox  1.8.8  to  convert  pdf  pages  to  image,  i see  
such  problem  for  page  1   of  attached  file (all  other my  files  
are  working  ok)

/Mar 20, 2015 4:31:22 PM org.apache.pdfbox.util.PDFStreamEngine 
processOperator//
//INFO: unsupported/disabled operation: i//
//
/and  saved  images  are   blank  (actually only  black  line is  
shown),  is  any  way  to  fix  this   problem  for  attached file?



this  is  my   function  i  use (nothing  special)



private void _pageDebug(PDDocument document, int page) throws 
IOException, IllegalArgumentException, PrinterException {

         PDPageable pdfInfo = new PDPageable(document);

         // convert page to image
         PDPage pdfPage = (PDPage) 
document.getDocumentCatalog().getAllPages().get(page - 1);

         BufferedImage imagePage = pdfPage.convertToImage();

         File outputfile = new File("c:/data/originalimage" + page + 
".png");
         ImageIO.write(imagePage, "png", outputfile);


}

private PDDocument loadDocument(String src) throws IOException {
         PDDocument document = null;
         try {

             document = PDDocument.load(src);


         } catch (IOException ex) {
             RandomAccessFile scratchFile = new RandomAccessFile(new 
File(src + "2"), "rw");
             document = PDDocument.loadNonSeq(new File(src), scratchFile);
         }
         return document;
     }


PDDocument     document = loadDocument(src);
this._pageDebug(document,  page);

-- 
Thank You,
vanja K.




Re: convert pdf page to image problem

Posted by Tilman Hausherr <TH...@t-online.de>.
Sadly, this is a known problem in the 1.8 versions: awt can't properly 
render type1 fonts. This has been rewritten in the 2.0 version, which is 
unreleased and has a different API. You can get it with svn. 
https://pdfbox.apache.org/download.cgi

Tilman


Am 30.03.2015 um 08:30 schrieb Vanja Kydysiuk:
> Hello  Tilman
>
> this  is  the  file
>
> http://storagemadeeasy.com/files/4089f90bd74f79b1e83db5865f5bd3cc.pdf
>
> thank you
>
> On Sat, Mar 28, 2015 at 4:38 PM, Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> Could you please upload your PDF to a public place?
>>
>> Tilman
>>
>> Am 25.03.2015 um 09:56 schrieb vanja K.:
>>
>>>
>>>
>>> I   use  pdfbox  1.8.8  to  convert  pdf  pages  to  image,  i see  such
>>> problem  for  page  1   of  attached  file (all other  my  files  are
>>> working  ok)
>>>
>>> /Mar 20, 2015 4:31:22 PM org.apache.pdfbox.util.PDFStreamEngine
>>> processOperator//
>>> //INFO: unsupported/disabled operation: i//
>>> //
>>> /and  saved  images  are   blank  (actually only  black line  is
>>> shown),  is  any  way  to  fix  this   problem  for attached  file?
>>>
>>>
>>>
>>> this  is  my   function  i  use (nothing  special)
>>>
>>>
>>>
>>> private void _pageDebug(PDDocument document, int page) throws
>>> IOException, IllegalArgumentException, PrinterException {
>>>
>>>          PDPageable pdfInfo = new PDPageable(document);
>>>
>>>          // convert page to image
>>>          PDPage pdfPage = (PDPage) document.getDocumentCatalog().getAllPages().get(page
>>> - 1);
>>>
>>>          BufferedImage imagePage = pdfPage.convertToImage();
>>>
>>>          File outputfile = new File("c:/data/originalimage" + page +
>>> ".png");
>>>          ImageIO.write(imagePage, "png", outputfile);
>>>
>>>
>>> }
>>>
>>> private PDDocument loadDocument(String src) throws IOException {
>>>          PDDocument document = null;
>>>          try {
>>>
>>>              document = PDDocument.load(src);
>>>
>>>
>>>          } catch (IOException ex) {
>>>              RandomAccessFile scratchFile = new RandomAccessFile(new
>>> File(src + "2"), "rw");
>>>              document = PDDocument.loadNonSeq(new File(src), scratchFile);
>>>          }
>>>          return document;
>>>      }
>>>
>>>
>>> PDDocument     document = loadDocument(src);
>>> this._pageDebug(document,  page);
>>>
>>> --
>>> Thank You,
>>> vanja K.
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: convert pdf page to image problem

Posted by Vanja Kydysiuk <va...@gmail.com>.
Hello  Tilman

this  is  the  file

http://storagemadeeasy.com/files/4089f90bd74f79b1e83db5865f5bd3cc.pdf

thank you

On Sat, Mar 28, 2015 at 4:38 PM, Tilman Hausherr <TH...@t-online.de>
wrote:

> Could you please upload your PDF to a public place?
>
> Tilman
>
> Am 25.03.2015 um 09:56 schrieb vanja K.:
>
>>
>>
>>
>> I   use  pdfbox  1.8.8  to  convert  pdf  pages  to  image,  i see  such
>> problem  for  page  1   of  attached  file (all other  my  files  are
>> working  ok)
>>
>> /Mar 20, 2015 4:31:22 PM org.apache.pdfbox.util.PDFStreamEngine
>> processOperator//
>> //INFO: unsupported/disabled operation: i//
>> //
>> /and  saved  images  are   blank  (actually only  black line  is
>> shown),  is  any  way  to  fix  this   problem  for attached  file?
>>
>>
>>
>> this  is  my   function  i  use (nothing  special)
>>
>>
>>
>> private void _pageDebug(PDDocument document, int page) throws
>> IOException, IllegalArgumentException, PrinterException {
>>
>>         PDPageable pdfInfo = new PDPageable(document);
>>
>>         // convert page to image
>>         PDPage pdfPage = (PDPage) document.getDocumentCatalog().getAllPages().get(page
>> - 1);
>>
>>         BufferedImage imagePage = pdfPage.convertToImage();
>>
>>         File outputfile = new File("c:/data/originalimage" + page +
>> ".png");
>>         ImageIO.write(imagePage, "png", outputfile);
>>
>>
>> }
>>
>> private PDDocument loadDocument(String src) throws IOException {
>>         PDDocument document = null;
>>         try {
>>
>>             document = PDDocument.load(src);
>>
>>
>>         } catch (IOException ex) {
>>             RandomAccessFile scratchFile = new RandomAccessFile(new
>> File(src + "2"), "rw");
>>             document = PDDocument.loadNonSeq(new File(src), scratchFile);
>>         }
>>         return document;
>>     }
>>
>>
>> PDDocument     document = loadDocument(src);
>> this._pageDebug(document,  page);
>>
>> --
>> Thank You,
>> vanja K.
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>
>

Re: convert pdf page to image problem

Posted by Tilman Hausherr <TH...@t-online.de>.
Could you please upload your PDF to a public place?

Tilman

Am 25.03.2015 um 09:56 schrieb vanja K.:
>
>
>
> I   use  pdfbox  1.8.8  to  convert  pdf  pages  to  image,  i see  
> such  problem  for  page  1   of  attached  file (all other  my  
> files  are  working  ok)
>
> /Mar 20, 2015 4:31:22 PM org.apache.pdfbox.util.PDFStreamEngine 
> processOperator//
> //INFO: unsupported/disabled operation: i//
> //
> /and  saved  images  are   blank  (actually only  black line  is  
> shown),  is  any  way  to  fix  this   problem  for attached  file?
>
>
>
> this  is  my   function  i  use (nothing  special)
>
>
>
> private void _pageDebug(PDDocument document, int page) throws 
> IOException, IllegalArgumentException, PrinterException {
>
>         PDPageable pdfInfo = new PDPageable(document);
>
>         // convert page to image
>         PDPage pdfPage = (PDPage) 
> document.getDocumentCatalog().getAllPages().get(page - 1);
>
>         BufferedImage imagePage = pdfPage.convertToImage();
>
>         File outputfile = new File("c:/data/originalimage" + page + 
> ".png");
>         ImageIO.write(imagePage, "png", outputfile);
>
>
> }
>
> private PDDocument loadDocument(String src) throws IOException {
>         PDDocument document = null;
>         try {
>
>             document = PDDocument.load(src);
>
>
>         } catch (IOException ex) {
>             RandomAccessFile scratchFile = new RandomAccessFile(new 
> File(src + "2"), "rw");
>             document = PDDocument.loadNonSeq(new File(src), scratchFile);
>         }
>         return document;
>     }
>
>
> PDDocument     document = loadDocument(src);
> this._pageDebug(document,  page);
>
> -- 
> Thank You,
> vanja K.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org