
OpenPDF 1.3.0 - roschdal
https://github.com/LibrePDF/OpenPDF/releases/tag/1.3.0
======
roschdal
I'm one of the maintainers of OpenPDF. Please give it a try and post your
feedback. Also, if you are using iText 1.2.x, it's time to update to OpenPDF,
which should be compatible.

[https://github.com/librepdf/openpdf](https://github.com/librepdf/openpdf)

~~~
mkl
Is there a version of PDFtk based on OpenPDF? PDFtk's original GCJ-compiled
iText isn't well supported any more.

~~~
roschdal
Thanks for the suggestion. I have forwarded this request to Sid in PDF Labs.

------
bsaul
Pdf so badly needs a standard open source reference implementation. the
problem with java is that it isn’t easy to reuse in other programming
environment...

something in C, or anything that compiles through LLVM would probably be a
better choice i think.

~~~
MartinMond
Google's PDFium which is used in Android and ChromeOS is fast becoming the
reference implementation to target:
[https://opensource.google.com/projects/pdfium](https://opensource.google.com/projects/pdfium)

~~~
merb
pdfium has literally no documentation. but the good thing is that it is c
which can be called from many languages.

~~~
jsty
"No documentation" seems a bit harsh - there's a Getting Started guide in
docs/ [0] and fairly good commenting on the interfaces in public/ [1]

[0]
[https://pdfium.googlesource.com/pdfium/+/refs/heads/master/d...](https://pdfium.googlesource.com/pdfium/+/refs/heads/master/docs/)

[1]
[https://pdfium.googlesource.com/pdfium/+/refs/heads/master/p...](https://pdfium.googlesource.com/pdfium/+/refs/heads/master/public/)

------
tasty_freeze
My particular needs for PDF creation are somewhat unusual, so I'm not
surprised that Acrobat Pro seems to be the only thing that suits my needs. If
anyone knows of a PDF creation library that has good support for the various
image compression schemes supported by PDF, I'd love to know about it.

Currently I'm using a 10 year old paid version of Acrobat Pro because I'm
unwilling to spend another $500 to get a modern copy simply to compress
images. I use it for scanning and archiving old computer manuals. In many
cases jbig on 1bpp images is good enough; other times I want to use one of the
more sophisticated hybrid schemes so I can have B&W or color images
interspersed on the page with 1bpp text. Acrobat does a pretty good job of
auto-deskewing images and doing analysis to figure out which compression type
to use in different sections of the same page.

~~~
bArray
It sounds like you are using Windows, but if you happen to be using Linux [1]:

    
    
        ps2pdf LARGE.pdf SMALL.pdf
    

I believe it compresses all of the images independently, instead of converting
the entire thing to an image as I believe Imagick does (I could be wrong
though). This tool doesn't appear to have any intelligent auto-deskewing
though. (On a slightly different note, it's questionable whether you want to
do this for archiving as it'll undoubtedly be a lossy operation.)

The reason I use this: Many websites for conferences have upload limits at
around 10MB, a size you can easily reach with a handful of images from a
modern device in your paper.

[1] [https://www.shellhacks.com/linux-compress-pdf-reduce-pdf-
siz...](https://www.shellhacks.com/linux-compress-pdf-reduce-pdf-size/)

~~~
mkl
I think this won't be useful for scanned documents, as the entire page will be
one image.

ps2pdf does work on Windows though (or maybe it's pstopdf?), and the Linux
version works directly in WSL.

~~~
bArray
I believe `ps2pdf` is just a front end script for Ghostscript. Even for
`ps2pdf` there are a bunch of options settable, most notably are the DPI
settings [1]. The point is that I believe it works for images and/or scalar
graphics.

As the PS format was designed for printing [2], my guess is that it selects a
DPI value suitable for printing. I can't seem to find the source code to back
this up though. (Ghostscript has the simple web front-end that doesn't lend
itself very well for viewing code in browser [3].)

[1]
[https://www.biu.ac.il/os_site/documentation/gs/Ps2pdf.htm](https://www.biu.ac.il/os_site/documentation/gs/Ps2pdf.htm)

[2]
[https://en.wikipedia.org/wiki/PostScript](https://en.wikipedia.org/wiki/PostScript)

[3]
[http://git.ghostscript.com/?p=ghostpdl.git;a=summary](http://git.ghostscript.com/?p=ghostpdl.git;a=summary)

~~~
mkl
It will work for images embedded in PostScript, and resample them to different
DPI if you ask (I think probably more for on-screen viewing and file size
reasons than printing). I would be kind of surprised if it does anything as
sophisticated as "B&W or color images interspersed on the page with 1bpp text"
though (i.e. analysing full page images, locating and separating text and
figure regions, and choosing different encodings for each). DjVu does do some
things along those lines, but it's not widely supported like PDF.

------
dhollenbeck
New Pure JavasScript low-level implementation to create and edit PDF files:
[https://github.com/Hopding/pdf-lib](https://github.com/Hopding/pdf-lib)

~~~
mkl
Tangential question: Do you know of a method to render PDFs to HTML canvas
other than PDF.js?

PDF.js seems too slow for my purposes, though I haven't tested very thoroughly
yet. I'm hoping with wasm Skia now available, there might be some other
options coming.

~~~
aloer
how does Skia and pdf work together? I know there is a pdf backend but the way
I understand it is that it just outputs pdf instead of an image

I recently started playing around with wasm Skia/CanvasKit but I have a hard
time wrapping my head around what exactly it is supposed to be used for, as
well as Skia in general.

For example, Skia allows text rendering and I could naively assume that if I
want to build some high performance 2D UI that Rendering text with Skia would
work reasonably well.

But at what level would text interactivity like selecting text happen?

I’m afraid this is a very generic question.

Are you familiar with any pdf or text related project that uses Skia and could
help me better understand what role Skia plays?

~~~
mkl
PDFium has a Skia backend, where Skia is used to do the actual drawing.
Interactivity happens at a higher level.

------
gibsonf1
We use this with great success in production:
[https://pdfbox.apache.org/](https://pdfbox.apache.org/)

------
cetra3
I tried to find a good comparison to PDFBox but came up short!

~~~
_JamesA_
From my experience OpenPDF is better at formatting and layout. PDFBox is a lot
lower level.

OpenPDF [1]:

    
    
      document.add(new Paragraph("Hello World"));
    

PDFBox [2]:

    
    
      contentStream.beginText();
      contentStream.setFont( font, 12 );
      contentStream.moveTextPositionByAmount( 100, 700 );
      contentStream.drawString( "Hello World" );
      contentStream.endText();
    
    

[1]: [https://github.com/LibrePDF/OpenPDF/blob/master/pdf-
toolbox/...](https://github.com/LibrePDF/OpenPDF/blob/master/pdf-
toolbox/src/test/java/com/lowagie/examples/general/HelloWorld.java)

[2]:
[https://pdfbox.apache.org/1.8/cookbook/documentcreation.html](https://pdfbox.apache.org/1.8/cookbook/documentcreation.html)

------
getpolarized
I've been heads down in PDF for about 6 months and looking at all the various
and supported libraries.

Within Polar ([https://getpolarized.io](https://getpolarized.io)) we support
pdf.js which is rather nice but ONLY supports viewing of the PDF and text
extraction.

You can't create NEW PDFs.

Our plan is to use something like OpenPDF to get the best of both worlds.
Editing PDFs for doing things like exporting could be done on the server and
the rest done on the client.

------
no_wizard
Is this a good library for doing automated PDF form filling (like via FDF?)

If not, is there any that are recommended? PDFTK is really showing its age in
an application we have (its slow, and often unreliable in large batch jobs)

------
jokoon
Can this render PDF form fills? Because PDF.js can't read them, and I must use
either PDFmaster or adobe.

Other question: Is it possible to build a document format similar to PDF
around SVG?

------
anahoneymaria
Great, Thank you

