Help with PDFtk function

yes saw that and just fixed why it was showing the pink area on load. Had to move a } from before the else to after the else statement… now it is working as you intended check it for yourself…

Okay, on to the html template size… gonna look back through the thread and see if I have it. If you have it handy that would be great though.

So yes, found the temp you converted, but it to displays too small when I hit the print button. I’ve been playing with ms publisher to see if I can get a better html template. I’ve tried several of the free online converters but all of them convert to smaller than 8.5 x 11 and Acrobat doesn’t even come close to looking like the original.

With Photoshop I’m creating jpegs from the pdf, then creating a new file in Publisher to insert the jpeg and then creating text boxes with the field names. Started playing with it last night and of course we were at this all day so I’ll have to get back at it…

Let me just say thanks a lot for everything you’ve done for me today. I really appreciate it. It’s not many people who would go this far or have the patience you’ve had with me to get this done to this degree. So for anyone else reading this, @ErnieAlex is a great example of someone willing to go beyond the norm to help someone learning the ins and outs of PHP. I take my hat off to him and again say thank you, my new friend.

I have not “given” you the solution! I wanted you to learn each and every part. You sound like you are going to incorporate more forms and many users. You need to know how it all works. I did not make it fancy or anything with nice CSS. You need look into CSS and also prepared statements to protect your site with.

I am glad to help. We made progress thru a lot of steps. And, it is nearly done! Good for you!
And, you are very welcome!

Now, do NOT use an app to play with the template. The reason is that a “canned” product ESPECIALLY Microsoft ones will add hundreds of added lines of useless code into your template. Manually edit it. If you want a good IDE for editing, you can try Netbeans as a lot of programmers use it and swear by it. Or, for HTML, you can just use Notepad++ which is a simpler editor but works great for HTML.

The template was converted in a first pass by the program I sent you a very long time ago. I will see if I still have it here. It gives you one week to test is and it works 100% great! Really super. After that, I manually edited it to fix the text displays and the alignments. I added in a CSS adjustment to fix these. I will look around and see if I have it. I think I sent it in a private message. Do not remember why…

Not up late tonight… But, will try to find both for you…

I found the program. It was a little pricey for me. But, it converted the one PDF to a HTML file with very good accuracy. After I converted the form which I downloaded from the Texas state site, it gave me a very good copy! It can be found at: Conversion App
It is free for one week. So, if you need to convert a lot of them it is worth it. If you only have a few, get them downloaded and ready and use the free one week to convert them to HTML. Then, edit each of them.

Still looking for converted file…

I found the converted file in a private message…
here is the url:

https://www.phphelp.com/uploads/default/original/2X/d/d9efbbe788613f174b45e30d27b3aac60065c065.html

let me rephrase… some of the fields are in the wrong place no that I look at it closer…

Hold on and I will fix that!

Odd, but, that version does not have the background shading and squares in place… Hmmmm?

Also, I can fix this, but, will take some studying. I am not sure if I can get it to you tonight. Heading to bed soon.
But, I can fix it up in the morning for you!

Bro, no rush… We been at this all day. I’m so happy with where we’re at now. The rest is minor things… I’m headed to bed too.

Heee! I couldn’t use the same program as it was over the 7 day test time.
So, I installed in on another computer here and voila, it worked on that one.
I redid the conversion. Just have to add the CSS into it and fix the size issue.

Will do it in the morning…

1 Like

Great I may have something too… see which comes closer.

Well, that program is interesting. It seems that it creates the background on the paper as an image.
Each page gets a background image. I found this out late last night before bedtime. So, resizing it is
slightly odd as you have to resize the background AND the HTML code, too. So, it can be done, but it is tricky to solve that one. I know of a way to fix it thru other converters, but, they bloat up the final page. Some of the online ones and Microsoft’s converters too, all seem to turn them into multiple files, like separate CSS files and others. Makes it very tricky to create an automated process. You can make them up yourself in just one file, but, that is very time consuming. I will look around for you today and see if I can come up with a better solution! What was your idea you mentioned?

OUCH! I found hundreds of great conversion sites. I found one that was 98% accurate. (They did not create the check-mark squares. But, we can fix that with ease. )

I am testing them all now for you. Each had different options. Will let you know the one I like best!

I am amazed how advanced some of these converters are these days! Very impressed!
I think I found the best one. It does not convert the check-mark-boxes. But, it puts them into the page in a set format so it is easy to convert them along with putting the data into place. I will drum up a routine for this and send you the file this morning!!! Should take an hour or so to finalize it all… Then we are in business! Ha!

Hey Ernie, I actually worked up a good HTML file last night by creating a jpeg of the PDF and using it as a background in Publisher. I then inserted the text boxes and saved it as an HTML file. This also created other files to backup the HTML but when viewed gives me a very good conversion compared to the original. I tried uploading it to my server and see it in the directory but when I call it with the code I get an error message that the file is not found. So I’m currently working on that issue. Going to speak with my hosting company, because even when I try accessing it through a URL directly I get a server 500 error. I read your other post and that sounds fine, so it looks like we both have stuff to do this morning. Thanks again and we’ll talk soon

Well, that way will NOT work. I have done that before and it never works. As you need to add in all the support files and figure out a way to add them into the creation process of the PDF file. Not easy to do. You can create a HTML file that way and have it displayed on the screen. Which would mean using background files. I have ways to handle that too. I have one way that converts the images into embedded strings. That seems to work okay. Especially if the file only uses a few images and small ones.

This way works 100% better than using one large background image for the form lines. I just tried about 50 websites and most did not do well. I finally found one that was almost perfect. But, it broke down the images into a ton of small ones. I contacted someone who has a full copy of Acrobat and he is testing it to see if it converts correctly to HTML. MS-Word did NOT. Other apps did NOT. Three of the online converters work great but created too many background files.

Still working on it… I will solve it!

Oh, don’t bother with your hosting company… It’s nothing to do with them. The 500 means you didn’t upload the files correctly.

So, if you create a folder with the HTML file in in. And, you have a folder inside that with the support files, you still need to edit the files to point to the server and then the sub-folders correctly. A Windows version works with sub-folders. But, the online version needs the images to point to the server’s version of the location.
Seldom works without changing the pointers to the images. If not correct, they throw out an error, sometimes a 500…

boy I feel stupid, the reason it wasn’t showing was it uploaded as a htm not html. and even when I found it the code says unable to convert because it could recognize the field names… so using publisher to create the html doesn’t work … figured I’d try, even though you said it wasn’t. LOL

need to find something that allows a background image and overlay text in absolute position without text boxes… that seems to be what the dompdf code is looking for. Gonna try working with photoshop to see how that comes out. Wish me luck

I am thinking… Do you want to just have the results opened as an HTML page instead of a PDF?
Does the system you are creating need to be PDF’s as outputs? As that so the user can keep a copy?

If they need to keep a copy, then PDF IS the way to go. I found a way to make almost a perfect copy of the HTML version, but, it contains a ton of support images. You can’t use those to do the PDF creation.

But, I found another library that uses images and creates PDF’s including them. So, this might work with the various background images. I will test it and let you know how it works. If it does work, then you can use Publisher or other HTML editors as the support images will work. I will try it right after lunch!

Sponsor our Newsletter | Privacy Policy | Terms of Service