'Richard Guion' wrote:Something is not working in my code which I've pasted below. I'm usingOpenPrinterto open the 'Adobe PDF' printer (return code is good), I callStartDocPrinter settingmy output file name to 'D:temptest.pdf' and set the datatype either to RAWor NULL,same result occurs: a test.pdf file is created, but it is pure text 'this isa test'instead of PDF content.1. General problem with use of the printer API - you are usingWritePrinter. That is defined to send exactly what you pass direct tothe printer, hence your result. That is only used if you have a stringalready in printer language. To print you must render to the printerDC just as you would render to the screen DC.
Client Raw Data Printing for PHP. Cross browser and Plugin-free for Windows, Linux, Raspberry Pi & Mac. Print without dialog box. Use with thermal, impact, dot-matrix, RFID, kiosk, POS, receipt, wristband printers. Download fully-functional eval version. Raw Print Server This is a simple RAW print server for Windows (also includes a tiny.nix script for.nix users) that lets your Windows 98/ME/NT/2K/XP system work as a port 9100 (or 910x) network print server for any of the Windows printers hooked up to the PC.
In other words you usecalls such as TextOut. Familiarity with the GDI part of the WindowsSDK is a must (or use some other classes or libraries equivalent).2. Specific problem with the Adobe PDF printer. If you had used GDIcorrectly you would not get a PDF file. You would get a PostScriptfile, because this method always bypasses the 'PDF port' which createsthe PDF. To get over this you must use the Distiller API, in theAcrobat SDK, to convert the PostScript file to PDF, and recreate whathappens automatically on a manual print operation.-Aandi InstonPlease support usenet! Post replies and follow-ups, don't e-mail them.Richard Guion02.12.03 19:08.
![]()
Aandi,Thank you very much for your advice. I tried what you described and now Ican generate bothpostscript and PDF files.The only kicker is that I need to handle the pagination, thruStartPage/EndPage calls. I also needto handle margin settings, etc., all as the.PS file gets generated.Whereas if you print a text filethru Notepad, select 'Adobe PDF' driver, it handles all that for you.Cheers,// Richard'Aandi Inston' wrote in messagenews:[email protected]. 1.
General problem with use of the printer API - you are using WritePrinter. That is defined to send exactly what you pass direct to the printer, hence your result. That is only used if you have a string already in printer language. To print you must render to the printer DC just as you would render to the screen DC. In other words you use calls such as TextOut.
Familiarity with the GDI part of the Windows SDK is a must (or use some other classes or libraries equivalent). 2. Specific problem with the Adobe PDF printer. If you had used GDI correctly you would not get a PDF file. You would get a PostScript file, because this method always bypasses the 'PDF port' which creates the PDF. To get over this you must use the Distiller API, in the Acrobat SDK, to convert the PostScript file to PDF, and recreate what happens automatically on a manual print operation.Aandi Inston03.12.03 1:26. 'Richard Guion' wrote toentirely too many groups:The only kicker is that I need to handle the pagination, thruStartPage/EndPage calls.Your best bet may be to write a PostScript prologue that defines thenecessary operations.
![]()
If by 'Pagination' you mean 'imposition' youmay have too optimistic a view of what you can do withBeginPage/EndPage. It cannot change the rendering sequence. I also needto handle margin settings, etc., all as the.PS file gets generated.Yep, that's entirely up to you.
When you call TextOut, or whatever,you have to choose the location to start the text. That's where themargins come from - there's nothing automatic in the printer (so faras I can see).Hmmm. On the other hand, I seem to recall that the GDI origin is thetop left of the printable area, i.e. Inside some minimal margins (notusually consistent with good practice).
If that's the case, you canquery the printer DC to find out what the printer's unprintableboundary is, and add that to the margin you actually want.-Aandi InstonPlease support usenet! Post replies and follow-ups, don't e-mail them.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |