PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD19] How to save a pdf to a temp file.
[WD19] How to save a pdf to a temp file.
Débuté par Curtis, 27 mar. 2015 17:33 - 5 réponses
Posté le 27 mars 2015 - 17:33
I have tried fSaveBuffer and fWrite to no avail.
sFile is string = "C:\ emp.pdf" nFileID is int = fOpen(sFile, foCreate) If nFileID <> -1 THEN // Can not figure out how to save an image fClose(nFileID) END
Posté le 27 mars 2015 - 19:08
Hi Curtis

it would be easier if you could explain what you are trying to do... I do not understand what "saving a pdf to a temp file" means...

If you want to make a copy of the pdf file, use fcopyfile
If you want to extract each page of the pdf as an image, load it page by page in an image field (using the ..numpage property) and save the image with dsaveimgeJPG
if you want to do something else, tell us what it is

Best regards
Posté le 27 mars 2015 - 20:24
More information: I scan a piece of paper and add it to an Image control with TwainToControl(). At this point I would like to save the image as a PDF to disk, but I do not want to use TwainToPDF() because users have the option to rotate the image and I do not want to do another scan.

The scanned images are being added to an analysis file as image memos. So alternatively, if there is a way to save an image in memory as an image memo that would be more effecient. I do not know if this is possible. As it stands I am saving the file to disk, writing to the analysis file, then deleting the file from disk.
Posté le 28 mars 2015 - 14:10
Hi Curtis

iPrintImage is your friend... with a pdf as the target, of course

Best regards
Posté le 30 mars 2015 - 15:40
As far as I can tell iPrintImage is only for printing to a printer?
Posté le 31 mars 2015 - 02:50
Hi Curtis

without seeing all of your code and window, I can't be sure, but if the print result is blurry, it's probably because your jpg image is too small... And the size of the image is the size of the image control in which you are scanning...

So you should increase the size of your field (you can set it outside of your window if need be) in order to have a much better quality

Best regards