Print Page | Close Window

Create PDF as Printer

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2654
Printed Date: 13 May 25 at 9:06AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Create PDF as Printer
Posted By: almiceli
Subject: Create PDF as Printer
Date Posted: 25 May 13 at 8:48PM
I would like to know if I can genrate a pdf document using the printer functionality in VB6.
I have a program that makes drawings and I would like to generate a pdf just like I was sending it to a printer (except use the PDF ActiveX) without worrying about installing a PDF writer.
 
Can anyone help me?
 
Thanks in advance



Replies:
Posted By: AndrewC
Date Posted: 29 May 13 at 2:22PM
You should try using 

http://www.quickpdflibrary.com/help/quickpdf/GetCanvasDC.php - http://www.quickpdflibrary.com/help/quickpdf/GetCanvasDC.php

to get a handle to a Device Context.  Use this DC and draw your document to it just like you would draw to a Printer based DC and then call

http://www.quickpdflibrary.com/help/quickpdf/LoadFromCanvasDC.php - http://www.quickpdflibrary.com/help/quickpdf/LoadFromCanvasDC.php  and 
http://www.quickpdflibrary.com/help/quickpdf/LoadFromCanvasDC.php - http://www.quickpdflibrary.com/help/quickpdf/NewPageFromCanvasDC.php

to create the PDF file in memory and then simply call QP.SaveToFile("output.pdf");

Andrew.


Posted By: almiceli
Date Posted: 07 Jun 13 at 9:05PM
I tried, but can not get it to work.
This is my code. Can you tell me what I'm doing wrong? (VB6- Arrays refer to shape objects)
Dim ClassName
Dim LicenseKey
Dim FileName
ClassName = "DebenuPDFLibraryAX0914.PDFLibrary"
LicenseKey = "the license key you gave me"
Dim QP
Dim Result
Set QP = CreateObject(ClassName)
Result = QP.UnlockKey(LicenseKey)
'If Result = 1 Then
MsgBox "Library version: " + QP.LibraryVersion
MsgBox (QP.LicenseInfo)
Call QP.GetCanvasDC(800, 1100)


'Call QP.LoadFromCanvasDC(0, 300, 300)
Dim I As Integer
Dim PLeft As Single
Dim PTop As Single
Dim PWidth As Double
Dim LongBoard As Double
QP.ScaleMode = 1
QP.ScaleTop = 0
QP.FillColor = &H0&
QP.FillStyle = 0
LongBoard = 0
'get longest board
For I = 0 To 30 Step 1
If LongBoard < CTD(I).Width Then
LongBoard = CTD(I).Width
End If
If TD(0).Width > LongBoard Then
LongBoard = TD(0).Width
End If

Next I
'CENTER PICTURE
PWidth = QP.Width - (TD(0).Width + 1500 + SVTD(0).Width + SVSTR.Width + SVBED(0).Width)
PWidth = QP.Width - (LongBoard + 1500 + SVTD(0).Width + SVSTR.Width + SVBED(0).Width)
PLeft = (PWidth / 2) - 1500
PTop = 1200
' LEFT TOP WIDTH HEIGHT
QP.CurrentX = 100
QP.CurrentY = 50
'QP.Print "PREPARED BY : " & Form1.PrepBy & " USING: Pallet-Track(R), Click-Draw(TM) SYSTEM."
QP.Print
QP.FontSize = 14
QP.FontBold = True
QP.Print "DESCRIPTION : " & Combo1.Text;
QP.CurrentX = QP.Width - QP.TextWidth("DRAWING #: " & Combo3.Text) - 1000
QP.Print "DRAWING # : " & Combo3.Text
QP.CurrentX = QP.TextWidth("DESCRIPTION : ")
QP.FontBold = False
QP.FontSize = 10
QP.Print Combo2.Text;
If Check2.Value = 1 Then
QP.Print " - PARTIAL 4 WAY ENTRY";
End If
If IsNumeric(Text4.Text) Then
If CDbl(Text4.Text) > 0 Then
If Check7.Value Then
QP.Print " - " & Text4.Text & " MM WING"
Else
QP.Print " - " & Text4.Text & " IN WING"
End If
Else
QP.Print " "
End If
Else
QP.Print " "
etc, etc.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk