PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun May 05, 2024 11:07 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Aug 27, 2012 11:43 am 
Offline

Joined: Mon Aug 27, 2012 11:17 am
Posts: 1
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 97 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group