Announcements
Hi All,
I am sending invoices as Pdf. I am using following code. It is sending selected invoices. But if I send 10 invoices 2 or 3 invoices get corrupted. But corrupted pdf can open from FoxitReader, not from Acrobat.
But if I send only identified corrupted pdf , it works fine.
Is there any problem with this code?
if SalesInvoiceHdr.FindFirst() then repeat clear(outStreamReport); clear(inStreamReport); clear(RecRef); clear(emailMsg); SalesInvHdr.Reset(); SalesInvHdr.SetRange("No.", SalesInvoiceHdr."No."); if SalesInvHdr.FindFirst() then RecRef.GetTable(SalesInvHdr); TempBlob.CreateOutStream(outStreamReport); TempBlob.CreateInStream(inStreamReport); body := ''; emailMsg.Create(SalesInvoiceHdr."Sell-to E-Mail", 'Your invoice ' SalesInvHdr."No." ' has been processed', body, true); Report.SaveAs(Report::"Posted Proforma Invoice", '', format::Pdf, outStreamReport, recRef); //txtB64 := cnv64.ToBase64(inStreamReport); emailMsg.AddAttachment('Sales Invoice ' SalesInvHdr."No." '.pdf', 'pdf', inStreamReport); email.Send(emailMsg); until SalesInvoiceHdr.Next() = 0;
Thank you,
TempBlob.CreateOutStream(outStreamReport); TempBlob.CreateInStream(inStreamReport); body := ''; emailMsg.Create(SalesInvoiceHdr."Sell-to E-Mail", 'Your invoice ' SalesInvHdr."No." ' has been processed', body, true); Report.SaveAs(Report::"Posted Proforma Invoice", '', format::Pdf, outStreamReport, recRef); //txtB64 := cnv64.ToBase64(inStreamReport); emailMsg.AddAttachment('Sales Invoice ' SalesInvHdr."No." '.pdf', 'pdf', inStreamReport); email.Send(emailMsg);
Hello Nitin,
Thank you. I was using this. It does not solved the problem. I then I moved to this method. Problem is when I resend same invoice individual it is working. when send selected list, this happens. Again it is only for acrobat reader, it works for other readers.
When I try pdf repair tool. I got following errors
rrors:
3-Heights(TM) PDF repair tool, evaluation license valid until unbounded
Open file.
Analyze Objects.
0x80410301 - E - The object number is missing.
- Object No.: 3
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410301 - E - The object number is missing.
- Object No.: 4
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410301 - E - The object number is missing.
- Object No.: 5
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410301 - E - The object number is missing.
- Object No.: 6
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410301 - E - The object number is missing.
- Object No.: 7
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410301 - E - The object number is missing.
- Object No.: 8
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410301 - E - The object number is missing.
- Object No.: 9
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410301 - E - The object number is missing.
- Object No.: 10
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410301 - E - The object number is missing.
- Object No.: 11
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410301 - E - The object number is missing.
- Object No.: 12
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410301 - E - The object number is missing.
- Object No.: 13
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410301 - E - The object number is missing.
- Object No.: 14
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
0x80410302 - E - The generation number is missing.
- Object No.: 15
- File: Sales Invoice INV100552.pdf
0x00418309 - W - The offset in the xref table is not correct.
- File: Sales Invoice INV100552.pdf
Analyze Outlines.
Analyze Pages.
0x80410402 - E - The page or page tree node has a missing or invalid "Type" key.
- Object No.: 8
- File: Sales Invoice INV100552.pdf
0x80410113 - E - The file is corrupt and cannot be repaired. Some of the contents can possibly be recovered.
- File: Sales Invoice INV100552.pdf
Close file.
Hi,
Try to use below link for attachment
emailMsg.AddAttachment('Sales Invoice ' + SalesInvHdr."No." + '.pdf', 'application/pdf', inStreamReport);
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156