Einhugur PDF Plugin Issue?

I have a problem I don;t have clue how to approach… Not 100% sure where teh problems lies

I have an app that needs to be live last week that analyzes a lot of data and produces a report created with the PDF plugin…
All my testing up to now was outputting a single report (though it could be 80 pages or so) and it seemed to be working fine…

But today I tried to use it in a loop… and the first report is fine, but on every other report created , creates teh first page OK but on the other pages have pictures but no text!

All of the code to create the PDF is done is a new instance of a class, which is nilled at the bottom of the loop so I don’t see how it could be a circular reference!!!

Could this be a bug in the plugin, or in my code (if do what should I look for)? Or is it memory issue (that would take a lot as I have 32GB RAM, though I am printing a lot of pictures!)

I’m at a loss and need to leave for vacation in the AM… and this needs to be solved before then!

I’m starting to wish I had used Asher’s old open source classes… (I looked at DynaPDF but the leaning curve looked a lot steeper than for the Einhugur plugin.

Thanks

  • Karen

if you do reports, you should look into either using the table classes in DynaPDF or a reporting tool like Bob Keeney’s shorts (With DynaPDF).

No, you don’t. It has a LOT of moving parts. Code left over from PPC days and just not complete. No font embedding and it has serious problems in Windows where the native PDF fonts don’t exist as font files to go plumb their data.

He started a complete rewrite but it only got 80% done which means that all the real work hadn’t been done yet. My original thought when purchasing was to update it and then move it into Shorts. Well, that hasn’t happened yet because the work to integrate DynaPDF wasn’t very hard and there are SO many more important things on the plate.

This is a VERY custom report for a lo of date coming from an instrument that does not fit the standard business formats.

That said I know how useful tables (and listboxes :wink: ) can be. Asher’s old classes (and I do still use them in some active apps) did have a table class… Something lacking in the Einhugur PDF Plugin … it just seemed a heck of lot faster t get up to speed with it, rather. than DynaPDF.

If that plugin turns out not to be the problem, and if I have time, I’ll write a table class for it if i need to.

  • Karen

It sounds a lot like it’s not being released correctly. I don’t use any plugin for PDF (as I hardly ever export PDF).

I’ve encountered some pretty weird issues in the recent OS version that have forced me to redesign how parts of the application loop.

I had to build a task queue, then use the timer.callLater function to call a function which processes the first item in the queue (and removes it) and then uses timer.callLater to call it’self again.

Somehow allowing the OS/Application run loop time seemed to clear up some issues, maybe it could work for you here?

Make sure you let Björn know, he’s a great guy and is normally very responsive.

And may in part depend on what pdf library is being used
There are few decent BSD licensed libraries. Not sure for a plugin you’d want GPL or LGPL code.
There’s one BSD one called libHaru that does basic level PDF stuff (which we looked at years ago) but it hasn’t been updated in 4 years

A decent one really needs to be licensed from one of the vendors like dyna, pdflib, etc or directly from Adobe who do have an OEM license. I have no idea what any of these guys terms & pricing are for a use case like a plugin but I can feel safe in saying “not cheap”. And that would drive the price of a plugin way up. I suspect MBS dyna pdf plugin pricing illustrates exactly this. But that’s just an educated guess.

Not sure if you’re on OS X only
If so you might be able to use PDFKit via declares

My first guess without having seen anything would be that the engine is left in some half state. Like left with a open drawing mode that has not been finalized. So when you come back for next report then your starting in incorrect state. If you complete each object correctly then everything should work. (In theory at least) Like you can take our example projects and generate report again and again and everything works.

So this is what I would recommend looking into.

I just started using it so can you be a bit more specific?

  • karen

When I was making the example projects then I experienced strangeness of various sorts. If I was not careful to not create invalid states or leave it in half finished states.

Like if you do LineTo but no Stroke or Fill then thats half state.

Or if you do LineTo and then you try to place a text then thats invalid state since you need to Stroke or Fill to go out of PathObject state before you draw Text.

LibHaru is very sensitive to such. (Which of course the plugin is based on) We have simplified it a lot though and taken care of the nastiest got-ya’s, but you still need to make sure you finish a state and don’t, do something invalid in the given state your in, like Drawing Text in middle of a PathObject state.

If your report is really huge then I would try to isolate the offending part by cutting it down, until it works.

Thanks Bjorn and all,

I found the issue…

I accidentally put the result of pdf.getFont into STATIC variable (not sure what I was thinking),… So trying to reuse the font across reports caused the issue.

  • karen