Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous. You can also use this link to report any problems registering.

CTS 6 - Save as bitmap

  • 2 Replies
  • 1198 Views
*

Offline sciurius

  • Jr. Member
  • **
  • 67
    • View Profile
    • Website
CTS 6 - Save as bitmap
« April 07, 2017, 07:13:59 AM »
It would be nice to be able to save/export a pdf as a bitmap image.

For example:

Code: [Select]
    $pdf->savepage_as_image( "out.png", 1 );                # saves page #1
    $page->save_as_image( "thispage.jpg" );                 # saves this $page

or even:

Code: [Select]
   $pdf->save_as_image( "page%04d.png" );              # save all pages in numbered files
<give number CTS 6 -- Mod.>
« Last Edit: April 07, 2017, 08:52:41 AM by Phil »

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 392
    • View Profile
Re: CTS 6 - Save as bitmap
« Reply #1: April 07, 2017, 09:02:32 AM »
That's an interesting proposition. Don't forget SVG, too!

I suspect that this would not be a trivial exercise. As a shortcut, there already are utilities to convert a PDF to an image file. I know that "GIMP" can import PDF files and then save them in any image format. Something like that might be a better choice than re-inventing the wheel.

See also the wkHTMLtoImage package (associated with wkHTMLtoPDF).

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 392
    • View Profile
Re: CTS 6 - Save as bitmap
« Reply #2: December 25, 2017, 01:56:17 PM »
 PhilterPaper commented on Sep 24

Since directly outputting various image formats (pixel or vector) would seem to be a huge undertaking, and utilities already exist to convert PDF to image, I'm not sure this is worth the effort. If someone can suggest methods that are a simple plug-in library or something similar (rather than writing it from scratch), I would be willing to take another look at it. There might be three approaches:

  • convert PDF data structures to graphics during page output
  • invoke an external utility (under the covers) to convert a just-written PDF file to image
  • directly write calls as graphics data rather than PDF primitives, but this threatens to be a huge task

PhilterPaper closed this on Sep 24
PhilterPaper added the wontfix label on Oct 1