Unplanned
Last Updated: 04 Sep 2023 11:16 by ADMIN
Lee
Created on: 07 Jun 2022 11:30
Category: PdfProcessing
Type: Feature Request
1
PdfProcessing: The auto size fields are not correctly imported/exported this setting is lost during export
The auto-size fields are not correctly imported/exported this setting is lost during export 
2 comments
ADMIN
Yoan
Posted on: 04 Sep 2023 11:16

Hi Lee,

Thank you for the provided details on the topic. I have verified that the shared approach can indeed be used as a solution for this scenario. This information will be taken into consideration moving forward with the task.

Your efforts are highly appreciated.

Regards,
Yoan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Lee
Posted on: 03 Sep 2023 10:23

After reading a few support tickets I was able to find a solution to this.

After merging all the PDF's into one document I noticed the auto font was there just not active. To resolve this I opened the merged PDF document and used the recalc appearances function. 

 

This worked unless you have the Acrobat extension installed. In that case you need to disable open PDFs in Adobe option. 

The end result is the PDF with Auto Size and other functionality display correctly in your browser and when you download to your local computer to open with Adobe Reader, Adobe Acrobat or your favourite PDF viewer. 

Sample Code: 

        Dim filename2 As String = "MergedDocuments.PDF"
        '* Open document And Recalc Appearances
        PDFdocument = providerPDF.Import(File.ReadAllBytes(Server.MapPath("~/") + filename2))
        PDFdocument.AcroForm.ViewersShouldRecalculateWidgetAppearances = True
        If File.Exists(Server.MapPath("~/") + filename2) Then
            File.Delete(Server.MapPath("~/") + filename2)
        End If
        Using output As Stream = File.OpenWrite(Server.MapPath("~/") + filename2) ' Export PDF to the output filepath
            providerPDF.Export(PDFdocument, output)
        End Using

        Dim url As String = "PDFViewer.aspx?Document=" + filename2
        Dim sb As New StringBuilder()
        sb.Append("<script type = 'text/javascript'>")
        sb.Append("window.open('")
        sb.Append(url)
        sb.Append("');")
        sb.Append("</script>")
        ClientScript.RegisterStartupScript(Me.GetType(), "script", sb.ToString())

This can be closed.