Witness Statement Form DRAFT v1.pdf (103.9 KB)
Please try using this one, these are the type of file I am working with.
Thank you.
Witness Statement Form DRAFT v1.pdf (103.9 KB)
Please try using this one, these are the type of file I am working with.
Thank you.
This PDF also does not have any form fields inside it. It only contains text content. Since, it does not have any selectable/fillable form fields like Checkboxes or textboxes, you cannot flatten anything in it. How you are using this template to fill out the information?
There are checkboxes and textboxes in the file attached above. For me the concept of flattening a pdf file is to make any interactable area of the file not interactable anymore.
If you can provide me with another example of pdf file that you feel is more suitable that will be appreciated because these are the files that I am working with at the moment.
Apologies if this is becoming a bother
We are sharing a sample basic PDF file that has acroform field in it. You can find a text box in this PDF that is fillable. Whereas, in your PDF, we could not find any field like it that can be used for interaction.
textbox.pdf (2.3 KB)
Thank you for sharing that, it gave me a sense of what to expect.
Did you achieve this using the code snippet that I sent above or another?
This file was achieved using the code snippet give in below article:
Please note that flattening a document basically removes/disables form fields in the PDF and places values instead at the same place.
Afternoon @asad.ali
Thank you very much for your help so far and everything has been working quite well.
I am looking to convert convert the result of the flattening method into a PDF/A but I have tried most of the methods you have available but none seem to work. I will post my code snippet below and attach a copy of the XFA form that I am working with.
public flattenPdfResponse FlattenPdf(flattenPdfRequest request)
{
byte[] byteArray = Convert.FromBase64String(request.encodedFileString);
MemoryStream mem = new MemoryStream();
mem.Write(byteArray, 0, byteArray.Length);
// return mem
MemoryStream returnMem = new MemoryStream();
// Finds forms and other fillable items in the
Aspose.Pdf.Document document = new Aspose.Pdf.Document(mem);
if (document.Form.Fields.Count() > 0)
{
foreach(var item in document.Form.Fields)
{
item.Flatten();
}
}
document.Convert(mem, PdfFormat.PDF_A_2U, ConvertErrorAction.Delete);
//document.Validate(returnMem, PdfFormat.PDF_A_2U);
document.Save(returnMem);<a class="attachment" href="/uploads/default/69639">DS0240B.pdf</a> (185.1 KB)
return new flattenPdfResponse(returnMem.ToArray(), string.Empty, HttpContext?.User?.Identity?.Name ?? "");
I am working with an XFA form and would just like to convert the result into a PDF/A format.
Thank you.
Just for clarification, you need to generate Tagged PDF. Right?? Not just any PDF/A format but only tagged PDF document?
For now just a PDF/A format is what I need
I want to be able to convert the file below
DS0240B.pdf (185.1 KB)
into something like this PDFen (1).pdf (112.0 KB)
while also flattening the form.
Thank you
We were able to notice that the API was not generating a valid output PDF/A document. Therefore, an issue as PDFNET-52875 has been registered in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.
We are sorry for the inconvenience.
Morning, I was wondering if you can provide me with an update for this issue PDFNET-52875. We are trying to deliver latest end of this week.
Thank you.
The ticket has recently been logged in our issue tracking system and we are afraid that it is currently pending for an initial investigation. Please note that the issues in free support model are resolved on a first come first serve basis and resolution time of the issues depend upon their complexity level as well as the number of issues logged prior.
Nevertheless, we have recorded your concerns and will surely inform you once we have some definite updates about ticket resolution. Please be patient and spare us some time.
We are sorry for the inconvenience.
Good morning @asad.ali
Currently I have 3 open tickets with your team and was wondering if we can get updates on them. Also is there a way to be prioritized on the ticket lists? Do we need to have an Aspose License because we already do?
Thank you.
We would like to share with you that tickets in Free support forum are resolved on a first come first serve basis regardless the license type you own. These tickets can be prioritized if you create topic in paid support forum with the reference to ticket IDs. This way the tickets will be escalated to the highest priority as paid support is for the issues that need to be resolved on an urgent basis. As soon as we make some progress towards ticket resolution, we will inform you in the respective forum threads. Please spare us some time.
We apologize for the inconvenience.
Hello @asad.ali
I was wondering if there has been any update on this ticket that we have open?
Thank you.
We are afraid that the ticket has not been resolved. We will surely let you as soon as some news is available about ticket resolution. Please spare us some time.
We are sorry for the inconvenience.
The issues you have found earlier (filed as PDFNET-52875) have been fixed in Aspose.PDF for .NET 24.6.
The document has several problems that need to be fixed in order to be able to convert the document using the Aspose.PDF library:
// 3. If MyriadPro fonts aren't installed on the machine, and aren't provided as external font files, then these fonts must be substituted
FontRepository.Substitutions.Add(new SimpleFontSubstitution("MyriadPro-Bold", "Arial-Bold"));
FontRepository.Substitutions.Add(new SimpleFontSubstitution("MyriadPro-Regular", "Arial"));
Aspose.Pdf.Document pdfDoc2 = new Aspose.Pdf.Document(dataDir + "DS0240B.pdf");
// Explicit form fields flattening isn't necessary, and it won't work with dynamic XFA form anyway. The Document.Flatten() call will be enough
//if (pdfDoc2.Form.Fields.Count() > 0)
//{
// foreach (var item in pdfDoc2.Form.Fields)
// {
// item.Flatten();
// }
//}
// 2. The form type must be changed from a dynamic XFA to a standard AcroForm
pdfDoc2.Form.Type = FormType.Standard;
pdfDoc2.Flatten();
// 1. Document privileges prohibit changing the document contents, so the must be relaxed beforehand. They may be restored after the conversion if needed
PdfFileSecurity security = new PdfFileSecurity();
security.BindPdf(pdfDoc2);
security.SetPrivilege(DocumentPrivilege.AllowAll);
pdfDoc2.Convert(dataDir + "log.xml", PdfFormat.PDF_A_2U, ConvertErrorAction.Delete);
pdfDoc2.Save(dataDir + "tagged.pdf");
Using the aforementioned code snippet, you will be able to convert the document from the Aspose.PDF 24.6 release onwards.
52875-out.pdf (4.7 MB)