PDF Form - File corrupted

Hi Juan,


Thanks for sharing the details.

Thanks for sharing the details. The information has been shared with product team and they will further look into this matter. As soon as we have some further updates, we will let you know.

Hi Juan,


Thanks for your patience.

In order to further investigate and figure out the reasons behind this problem, we need following information

- Provide screenshots of PS driver preferences
- Describe step by step the printing process

The earlier sent screenshot only contained driver’s tab with version but we need screenshots of all tabs.

Hi,



- ScreenShotsPSDriver.zip

- I use Adobe AcrobatX, I simply open file and printing with PS driver.



thank you

Hi Juan,


Thanks for sharing the required details.

We are further investigating the issue based on recently shared information/details and will keep you updated with our findings.

Hi,

Do you have any news about our problem? The ticket has at least one year by now and we still can’t use the last version of the product. I really think it is a bit too long.

Meanwhile, we are still using our old version (8.2) installed on Windows 2008.
Is this version also compatible with Win 2012 Standard?

Thanks,

Leonardo

Hi Leonardo,


Thanks for your patience.

I am afraid the earlier reported issue is still under investigation and is not yet resolved. However I have inquired the latest updates from product team and have also shared your concerns with them. As soon as we have some further updates, we will let you know.

Hi,

Thanks for the quick reply.
But what about using Aspose 8.2 and Windows 2012, are they compatible?

Thanks

Hi Helene,


Thanks for your inquiry. Moreover, please note Aspose.Pdf for .NET is independent of any other installation. It is .NET Framework dependent, you can use it on any platform/application based on .NET Framework. It will work with Windows 2012. However, if you face any issue then please feel free to contact us.

Best Regards,

rampgouv:
Hi,

Thanks for the quick reply.
But what about using Aspose 8.2 and Windows 2012, are they compatible?
Hi Helene,

Thanks for sharing the details.

Adding more to Tilal's comments, you are using a quite older release of Aspose.Pdf for .NET, and we always recommend using latest release. Can you please try using the latest release and share your findings.

Yes, I know.
That’s why we have <!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>FR-CA</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><span style=“font-size:11.0pt;font-family:“Calibri”,sans-serif;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:
“Times New Roman”;mso-ansi-language:FR-CA;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA”>PDFNEWNET-39458 opened since Sept-2015!
As you haven’t found a solution to our problem, we still have to use the last working version (8.2)…
I would appreciate an extra effort to solve our case, so we could starting using the last Aspose version.
<!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Tableau Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman",serif;}

<![endif]–>

Hi Helene,


Thanks for sharing the details.

We do understand the criticallity of issue and inconvenience which you have been facing but as stated earlier, the issues are resolved in first come first serve basis as its the fairest policy to all the customer. Nevertheless, as soon as we have some definite updates, we will let you know.

We found the source of the problem.

In the attached Template(Template.pdf), the fonts used are “Helvetica and Helvetica-Bold”, however the form fields use “Times New Roman Gras” when filling in the document with this code, version 8.2 and 16.10. 1 are not doing the same job.

'Get Template
ObjStrmFichPDFEntre = New MemoryStream (_bytFichPDFBin)
ObjForm = New Aspose.Pdf.Facades.Form (objStrmFichPDFEntre)

'Fill Fields
objForm.BindPdf (objStrmFichPDFEntre)
objForm.FillField ( “TxtNomImprimante”, “\ IMPPRODQUE2 \ Q800”)
objForm.FillField ( “TxtNomDocument”, “RBI_CRF5_26799666”)
ObjForm.FillField (“TxtLot”, “1 of 1”)
objForm.FillField ( “TxtExpediteur”, “BJE5”)
objForm.FillField ( “TxtDepot”, “B280”)
objForm.FillField ( “TxtPage”, “12”)
ObjForm.FillField (“TxtDate”, “2015-09-24 13:54:26”)
ObjForm.FillField (“TxtProcessManutention”, “Process 1 (number of pages (s): 12)”)

objForm.FlattenAllFields ()

ObjStrmFichPDFSorti = New MemoryStream
objForm.Save (objStrmFichPDFSorti)

Version 8.2 incorporated the TimesNewRomanBold font in the file (Template_Aspose8.2 W2012.1.PDF-572KB) in a different way than the 16.10.1 version too (Template_Aspose.16.10.1_W2012.PDF-50KB), which is why the file size difference.

So the problem of printing on some printers is due to the lack of font information in the file generated by version 16.10.1.

Do you have a method or property that makes it mandatory to embed the font in the resulting file as did version 8.2?

Please, get back with an answer as soon as possible, as we want to use the latest version of the product.

Thanks you
Template.pdf (17.0 KB)
Template_Aspose.16.10.1_W2012.PDF (49.8 KB)
Template_Aspose8.2 W2012.1.PDF (571.4 KB)

@jechevarria,
We are working over your query and will get back to you soon.

Best Regards,
Imran Rafique

@jechevarria,

Thanks for sharing the details.

I have tested the scenario using latest release of Aspose.Pdf for .NET 17.8 where I have used the code snippet which you have shared earlier and as per my observations, the file of 54KB is generated. However in order to embed the fonts in PDF document, you may consider using the instructions specified over Embed fonts in existing PDF file. For your reference, I have also attached the output generated over my end. Please note that Times New Roman Bold is embeded as subset and can you please try printing it and confirm if the problem still persists.

Resultatn file FontsEmbedded.pdf (54.5 KB).

Please note that once that data is inserted in PDF form using Aspose.Pdf.Facades.Form object, you can then save the output to Stream instance and then instantiate new Aspose.Pdf.Document object where you load the stream contents and then perform font embedding operations. Specified below is the equivalent code snippet in C#.

[C#]

Aspose.Pdf.Facades.Form ObjForm = new Aspose.Pdf.Facades.Form();

//'Fill Fields
ObjForm.BindPdf("c:/pdftest/Template.pdf");
ObjForm.FillField( "TxtNomImprimante", "\\ IMPPRODQUE2 \\ Q800");
ObjForm.FillField("TxtNomDocument", "RBI_CRF5_26799666");
ObjForm.FillField("TxtLot", "1 of 1");
ObjForm.FillField("TxtExpediteur", "BJE5");
ObjForm.FillField("TxtDepot", "B280");
ObjForm.FillField("TxtPage", "12");
ObjForm.FillField("TxtDate", "2015 - 09 - 24 13:54:26");
ObjForm.FillField("TxtProcessManutention", "Process 1(number of pages(s): 12)");

ObjForm.FlattenAllFields();
MemoryStream ms = new MemoryStream();
ObjForm.Save(ms);
Document doc = new Document(ms);
// Iterate through all the pages
foreach (Page page in doc.Pages)
{
    if (page.Resources.Fonts != null)
    {
        foreach (Aspose.Pdf.Text.Font pageFont in page.Resources.Fonts)
        {
            // Check if font is already embedded
            if (!pageFont.IsEmbedded)
                pageFont.IsEmbedded = true;
        }
    }

    // Check for the Form objects
    foreach (XForm form in page.Resources.Forms)
    {
        if (form.Resources.Fonts != null)
        {
            foreach (Aspose.Pdf.Text.Font formFont in form.Resources.Fonts)
            {
                // Check if the font is embedded
                if (!formFont.IsEmbedded)
                    formFont.IsEmbedded = true;
            }
        }
    }
}

doc.FontUtilities.SubsetFonts(Document.FontSubsetStrategy.SubsetAllFonts);
// Font subset will be embedded for fully embedded fonts but fonts which are not embedded into document will not be affected.
//                doc.FontUtilities.SubsetFonts(Document.FontSubsetStrategy.SubsetEmbeddedFontsOnly);

doc.Save("c:/pdftest/FontsEmbedded.pdf");
//ObjStrmFichPDFSorti = New MemoryStream
//ObjForm.Save("c:/pdftest/FormFielled.pdf");
ms.Close();

Hello,

We still have the problem of printing with the file you sent us, however, I found the difference between version 8.2 and the newer versions of Aspose PDF
Differences.png (59.0 KB)

With version 8.2, the TimesNewRomanBold font is Embedded only, but with the other versions the default font is Embedded and SubSet, so the font is partially embedded in the resulting PDF file, so that is why on some printers the print does not work .

In the code you sent me, I added IsSubSet = False for the TimesNewRomanBold font and I left IsEmbedded = true, and then printing the generated PDF document worked correctly on all printers.

It is true that it is better to have a subset of the font because the PDF file is smaller, but in my case I think I would not have the choice to incorporate it completely.

Do you have any other recommendation on the solution of the problem?

Thank you

@jechevarria,

When viewing or printing the PDF document, the related application tries to load fonts used inside the document and when we use Subset option, the complete font is not embedded inside the document and application tries to load the font from system directory. However when using Embedded option, the complete font is included inside the document and when loading/viewing the document, the fonts embedded inside the document are used and file contents are displayed appropriately.

However in order to optimize the size of PDF file, you may consider using the instructions specified over Optimize PDF file size.

Hi,

For me, this issue is resolved.

Thank you!

@jechevarria,

We are glad to hear that your problem is resolved. Please continue using our APIs and in the event of any further query, feel free to contact.