Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 3 Jahren, 4 Monaten
Letzter Beitrag:
vor 3 Jahren, 4 Monaten
Beteiligte Autoren:
Fabrice Harari, Curtis

[WD19] How to save a pdf to a temp file.

Startbeitrag von Curtis am 27.03.2015 16:33

I have tried fSaveBuffer and fWrite to no avail.

sFile is string = "C:\temp.pdf"

nFileID is int = fOpen(sFile, foCreate)
If nFileID -1 THEN
// Can not figure out how to save an image

fClose(nFileID)
END

Antworten:

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

von Fabrice Harari - am 27.03.2015 18:08
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.

EDIT: I would love to figure out how to link an image control to an analysis file.
HLinkMemo(Customer, CustomerImage, ImageControl, hMemoImg)

EDIT2: Passing the image control seems to work fine, if the image control has been loaded from a file(fSelect). But when I pass an image control that's been loaded from the scanner, it saves a blank memo.

von Curtis - am 27.03.2015 19:24
Hi Curtis

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

Best regards

von Fabrice Harari - am 28.03.2015 13:10
As far as I can tell iPrintImage is only for printing to a printer?

EDIT: I got this code working, but the PDF is blurry.

iDestination(iPDF, sFile)
iPrintImage(IMG_ScannerPreview,0,0,iPageWidth,iPageHeight,iNormalDisplay)
iEndPrinting()

von Curtis - am 30.03.2015 13:40
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

von Fabrice Harari - am 31.03.2015 00:50
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.