-2

I want to crop pdfs and save them as pngs using my delphi program.

I am currently using the cmd tool pdftocairo to do this.

I want to use the libcairo-2.dll from poppler in my program to use the crop function but there is no documentions on how to call this lib.

This is how i use pdftocairo in cmd :

pdftocairo -png -r 168 -x 56 -y 1150 -W 1154 -H 370 pdf.pdf Extract/0

now how to call the libcairo dll so using this in my delphi program will be more helpfull as in error codes ?

  • 2
    If there's no documentation regarding how the DLL is to be called, you can't use it. Contact the authors to ask them for documentation. – Ken White May 01 '19 at 12:11
  • AFAIK, libcairo-2.dll is part of the Inkscape, Gimp, Octave and FreePascal distributions, and like these programs, it is open source. I'm pretty sure that the Cairo graphics library is documented, for instance the official API docs: https://www.cairographics.org/manual/ – Rudy Velthuis May 01 '19 at 13:10
  • FWIW, FreePascal (I have one of the latest) in Windows has source files for Cairo in **/foc/packages/cairo/src**. Take a look there. – Rudy Velthuis May 01 '19 at 13:14

1 Answers1

0

libcairo-2-dll is part of many open source distributions, like Inkscape, Gimp, Octave and (hah!) FreePascal.

It is the DLL for the Cairo graphics library.

Documentation can be found on the Cairo site.

Note:

FreePascal also has interface units for it (cairo.pp, cairoft.pp, cairogobject.pp, cairowin32.pp and cairoxlib.pp) in the <FreePascal>/fpc/packages/cairo/src directory. You may want to take a look there too.

According to Wikipedia, there are "language bindings" (in our case, interface units) for Delphi too. But Cairo doesn't mention them on their Bindings page, but then, it doesn't list the FreePascal bindings (see above) either.

I did find Delphi bindings, but don't know how good they are:

Rudy Velthuis
  • 28,387
  • 5
  • 46
  • 94