Hi,
I have created one Business Card (pdf format). Then i created a pdf file through codes which has multiple instance of the prepared car. The code which creates the final file is ..
Public Sub myCreatePrintVersionPDF(ByVal strFileName As String, _
ByVal Rows As Integer, _
ByVal Cols As Integer, _
ByVal Xmargin As Integer, _
ByVal Ymargin As Integer, _
ByVal CardWidth As Integer, _
ByVal CardHeight As Integer, _
ByVal HorizontalPitch As Integer, _
ByVal VerticalPitch As Integer, _
ByVal HorizontalSpace As Integer, _
ByVal VerticalSpace As Integer)
' Get fresh copy of the source PDF file
Dim SourceFile As String = strFileName
' Create the output document
Dim outputDocument As New PdfDocument()
Dim gfx As XGraphics
Dim form1 As XPdfForm = XPdfForm.FromFile(SourceFile)
Dim page1 As PdfPage = outputDocument.AddPage()
'Setting values for test instead of passing parameters
Xmargin = 10
Ymargin = 10
Rows = 4
Cols = 1
HorizontalSpace = 10
VerticalSpace = 10
CardWidth = form1.Width
CardHeight = form1.Height
HorizontalPitch = CardWidth + HorizontalSpace
VerticalPitch = CardHeight + VerticalSpace
'page1.Width = XUnit.FromMillimeter(Xmargin + HorizontalPitch * Cols)
'page1.Height = XUnit.FromMillimeter(Ymargin + VerticalPitch * Rows)
page1.Width = XUnit.FromPoint(Xmargin + HorizontalPitch * (Cols + 1) - HorizontalSpace + Xmargin)
page1.Height = XUnit.FromPoint(Ymargin + VerticalPitch * (Rows + 1) - VerticalSpace + Ymargin)
gfx = XGraphics.FromPdfPage(page1)
Dim Row, Col As Integer
For Row = 0 To Rows
For Col = 0 To Cols
'gfx.DrawImage(form1, New XRect(10, i * (form1.Height + 5) + 10, form1.Width, form1.Height))
gfx.DrawImage(form1, Xmargin + HorizontalPitch * Col, Ymargin + VerticalPitch * Row, form1.Width, form1.Height)
Next Col
Next Row
outputDocument.Save("C:\PrintVersionPDF.pdf")
gfx.Dispose()
outputDocument.Close()
outputDocument.Dispose()
End Sub
The Problem is the PDF file gets generated as expected but the left portion of the business card gets truncated. Is there any soulution for this.
_________________ FROM PDF
|