I humbly ask the Monks for their sage advice.
Well, I have a project that requires me to: parse a PDF file, add some content inside the file, then out put the file for viewing on a browser that has Adobe Acrobat reader installed. I searched the net. I found the great pdflib library but found out that it would cost me $1000 to get a licence for their PDI library that would allow me to parse the PDF then manipluate it. So, I searched some more. I found Panda PDF project that seemed to fit the bill. I downloaded the source then compiled into a Windows DLL since that is the system that I am using. I was going to use ActivePerl's Win32::API to call into the dll to access the functions and allow me to complete this project.
At first, it seemed to work. I needed to call a function that takes two char *. I read the manual for Win32::API. I found out that you need to pack the variables to pass into the function if they are pointers. Here is some sample code to show you what I mean:
use Win32::API; $panda_init = Win32::API->new("c:\\temp\\panda", "panda_init", [], V); $panda_init->Call(); $panda_open = Win32::API->new("c:\\temp\\panda", "panda_open", [P, P], P); $filename = pack("p", "dd.pdf"); $mode = pack("p", "w"); $panda_open->Call($filename, $mode);
When I did this it returned "Unknown file mode handed to panda." Now I looked in the docs and the source. The only supported file mode right now is "w". Although, it always returns this error no matter what character I pack.
Does anyone have experience with Win32::API enough to give me some clues? It is probably my pack but I cannot be sure. I am about to go hack the code to see what the function thinks it is receiving but I wanted to know if anyone has encountered this before I start.
Many many thanks in advance!
In reply to Pack and Win32::API by cyocum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |