HTML in a PDF Report

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Jaymer
Posts: 2458
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

AND the parser in the new library is picky as hell

Post by Jaymer »

For one I ran across, You can't have a '&' in your data.
In this text field on my PO, in the text field the user had typed "type 1 & 2 items"
that barfed when printing:
picky1.png
picky1.png (85.83 KiB) Viewed 177 times
I can imagine using a REPLACE_PATTERN on the field before printing, BUT if its ALREADY html, then its going to be loaded with &s;

any URL with query parms will have a valid "&" inside the html.

Or consider a non-breaking space:   (this could easily be inserted by someone when they are creating their verbage in the HTML editor)
How do we replace "Bob & Ted", or "Bob &Ted" and get "Bob & Ted"
and yet NOT transform   or any number of other valid escaped thingies.

OK, so moving on, I just removed the 2 instances of "&" and got past that error.


We all know how much of a pain it is to build a string with embedded quotes.
Cleaner now with SQ() and DQ(), but it was doable before using SystemSettings.DQ

I usually get away with NOT putting double quotes around the style="color:red" types of html. Browser seems to parse it just fine. And since it was a lot of work to clutter the expression with SystemSettings.DQ, since it worked, I skipped it. But not in the HTLM Report now. Thats thing will complain.
picky2.png
picky2.png (88.79 KiB) Viewed 177 times

I designed it using "class", but it ignores it. A lot more effort for inline styles. I just haven't removed the class descriptors.
And I wanted the option to format each element in the future, which is why they all got a class originally.
I'm building this string and had to add all the quotes tonight to get it working (although poorly).
thehtml.png
thehtml.png (114.59 KiB) Viewed 177 times
Last edited by Jaymer on Wed Apr 03, 2024 4:02 am, edited 2 times in total.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Posts: 2458
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

STILL CANNOT DO MY ORIGINAL REQUIREMENT

Post by Jaymer »

because of the poor bitmapped fonts, I can't fit all my text in.

1st is 10 point, and then 8 to help it fit - but then not readable.
10pix.png
10pix.png (24.06 KiB) Viewed 176 times
8pix.png
8pix.png (31.27 KiB) Viewed 176 times
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Posts: 2458
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Why do it this way

Post by Jaymer »

Imagine having a floor plan of a building.
I have 42 offices.
I'm trying to put 11 pieces of into into each office slot.

Rather than having 462 fields on the report, I have 42.
I'm building a string of data for each slot.

This works now and is nice and readable.
plan1.png
plan1.png (101.3 KiB) Viewed 176 times
But I want to color some lines.
Not even sure how the report writer would handle 500 fields?
What if I need to add another piece of data to a slot? ... add another 42 fields and move everything around - OMG

With as finicky as selecting fields is in the RW I'd go crazy trying to do this.

Smart thing (I thought) was to test the 42 fields and building the file.
Easy. As well as building the 'plain text' string for the slots - although its not pretty.

Then to build the text in HTML is now where its broke down due to the visibility issues.
A loop build everything so changing the formatting is simple... but the whole thing is in jeopardy because of this HTML issue.

I also had planned to have HTML code to put a number in each slot - for easier viewing - like a "badge" format in the upper right. Again, what a pain to add another 42 fields inside the RW - whereas its just 1 more line in the HTML string.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
customaware
Posts: 2407
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: HTML in a PDF Report

Post by customaware »

That's disappointing.

I needed a solution in V8.8 so ended up displaying conditional images
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
Jaymer
Posts: 2458
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: HTML in a PDF Report

Post by Jaymer »

MORE DISAPPOINTMENT

If you have a report field with the 'html' or html added (it actually doesn't matter if you use the quotes),
AND THE FIELD IS NULL (ie. UNDEFINED in Aware),

you'll get this runtime error and the report fails and will not execute.
In my case, I'm not even printing it - I added a switch to allow the user to use Plain Text vs. HTML (since the HTML is not respecting fonts and comes out ugly). I ATTACHED CONDITIONS in the report to print one or the other.

So I have TWO comment fields - a Plain Text and another Plain Text/HTML.
If they only enter into the Plain, then the HTML is UNDEFINED. And it won't print.
(of course, I'm handling it with a Rule - but I shouldn't have to. this new HTML Report library is a stinker.)
empty_html_field.jpg
empty_html_field.jpg (37.39 KiB) Viewed 152 times
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Posts: 2458
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: HTML in a PDF Report

Post by Jaymer »

OK, well this rule won't work:

If POInstall.Comment_HTML IS UNDEFINED Then
POInstall.Comment_HTML = ' '


Because then technically the HTML field STILL doesn't have anything in it and then you get this error:
empty_html_field2.jpg
empty_html_field2.jpg (39.37 KiB) Viewed 150 times
Of course, now you start putting data in fields that should be empty and other tests MAY fail (like checking for UNDEFINED).
I have to put a '.' (a period) in the field thats not going to print anyway just to get past the new Report Library issues.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Post Reply