Hello.
I have a problem with setting page size in my application. I used this code
Code:
Imports PdfSharp.Drawing
Imports PdfSharp.Pdf
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myPdfDocument As New PdfSharp.Pdf.PdfDocument
Dim pdfPAge As New PdfSharp.Pdf.PdfPage
Dim PdfElement As PdfSharp.Drawing.XGraphics
Dim fileName As String
Dim myprocess As New System.Diagnostics.Process
fileName = "tescik.pdf"
pdfPAge = myPdfDocument.AddPage(pdfPAge)
PdfElement = XGraphics.FromPdfPage(pdfPAge)
myPdfDocument.PageLayout = PdfPageLayout.SinglePage
pdfPAge.Size = PdfSharp.PageSize.A4
pdfPAge.Orientation = PdfSharp.PageOrientation.Portrait
pdfPAge.TrimMargins.Right = cm(0.5)
pdfPAge.TrimMargins.Left = cm(0.5)
pdfPAge.TrimMargins.Top = cm(0.5)
pdfPAge.TrimMargins.Bottom = cm(0.5)
PdfElement.DrawRectangle(Pens.Black, cm(5), cm(5), cm(5), cm(5))
myPdfDocument.Save(fileName)
myprocess.StartInfo.FileName = "Acrord32.exe"
myprocess.StartInfo.Arguments = "/p " & fileName
myprocess.Start()
End Sub
Function cm(ByVal centimeters As Single) As Single
Return centimeters * 28.34645 ' 1/72 of inch to centimeters
End Function
End Class
When Acrobat run, There are three options in size tab
1- Fit
2 - Actual Size
3 - Shring oversized pages
The default options for me is "Fit"
I' would like to set it in my application to "Actual size" and then print.
Is there any chance for that? Or maybe there is a way to set my print to looks always the same, when user choose one of this three options
Best Rregards