Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support

All forums · Statistics · Search ·

Two Pilots forum / For software developers / Evaluating PDF Creator
Author Message
Hans Reich
# Posted: 8 Jun 2004 23:05 · Edited by: Hans Reich

I have been trying to evaluate PDF Creator (demo version) for use in a Visual Basic program that creates graphics images. I considered three methods. In each one I ran into serious problems that may make it impossible to use PDF Creator:

(1) Using your graphics primitives (Lineto, TextOut etc) and doing all of the positioning and formating work in my program. However, I find one problem here: in my hands the TextShow function does not work - I have tried several combinations, but no text appears. I don't believe it is possible to create properly formatted text (subscripts, superscripts, font changes, etc) without the TextSHow method.

PDF.PDFPAGE_SetTextPosition 40, 40
pdf.PDFPAGE_TextShow "Continue" 'fails to put anything on the page

(2) Using the HDC property and the WINAPI calls that are already well developed in my program. In spite of an absence of documentation as to how one uses this (e.g. what API calls are supported?) I was able to make this work, except for one problem: when I specify coordinates, the positions for lines and text seem to be exactly 3/4 as long as specified (I have to multiply each X and Y coordinate by 4/3 to get the distances right). I determined this by drawing the same lines using the built in PDF functions pdf.PDFPAGE_MoveTo() and pdf.PDFPAGE_LineTo(). A VB subroutine, derived directly from your examples follows. Unless XSc and YSc are set to 4/3 (as shown below) the WINAPI lines will not be the right length, rather the line drawn with MoveToEx() and LineTo() will be too short. What is going on here, and how do I get around this? Obviously, arbitrarily multiplying all coordinates by 1.333 is hardly a proper way to go.

Private Sub Command4_Click()
Dim HDCPDF As Long
Dim XSc!, ySc!
Set pdf = CreateObject("PDFcreatorPilot2.piPDFDocument")
pdf.StartEngine "demo@demo", "demo"
pdf.DocumentInfo_CreationDate = Now
pdf.DocumentInfo_Title = "PDF Creator Pilot Demo (Work withWIN API)"
pdf.filename = "d:\_odds_ends\pdf-devlop\HDC.pdf"
pdf.AutoLaunch = True
pdf.PageLayout = 1
pdf.Compression = 1
pdf.PDFPAGE_Width = 300
pdf.PDFPAGE_Height = 300
HDCPDF = pdf.hdc
XSc! = 4 / 3
ySc! = 4 / 3
'draw a line using WIN API calls
Call MoveToEx(HDCPDF, 10 * XSc!, 20 * ySc!, 0&)
Call LineTo(HDCPDF, 280 * XSc!, 290 * ySc!)
'Draw a parallel line using PDF-Creator calls
pdf.PDFPAGE_MoveTo 10, 10
pdf.PDFPAGE_LineTo 280, 280
'the lines are the same length only if XSc and YSc are 4/3 (1.3333)
End Sub

(3) Creating an Enhanced Metafile from each page using WINAPI calls, and then creating the PDF document by assemling these, one to a page. I can get PDFPAGE_PlayMetaFileFromFileName to work (using your example and one of my metafiles), but I was unable to get the PDFPAGE_PlayMetaFileExFromFileName to work, which is needed to scale metafiles.

Also, I was unable to use any of the PDF drawing commands on the same page as a metafile was played. Is this a limitation? If so, your documentation should clearly state it.

# Posted: 11 Jun 2004 10:06

Dear Hans,

(1) Please, try to use PDFPAGE_UnicodeTextOut for text output;
(2) and (3) Please try to set Resolution property of document to the resolution of EMF file

There are two layers available in PDF document and you can use "watermark" layer to draw metafile and normal layer to draw your own text and graphics on it.



Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.016


Page top