Error en insertar PDF417

Some other discussions. Feel free to post anything here !
Post Reply
fdsosa
Posts: 7
Joined: Wed Apr 19, 2023 10:36 pm

Error en insertar PDF417

Post by fdsosa » Tue May 16, 2023 6:40 pm

Disculpe intento convertir un documento DOCX a PDF e insertar un codigo PDF417 pero no lo inserta y ejecutando el proceso me dice que si lo inserto .
Me podrian decir en que esta fallando ya que el proceso me da un OK y no inserta en codigo PDF417


Muestro ejemplo del codigo implementado:





public static void DrawPDF417CodeOpen(CustomActionEventArgs e)
{
MyCustomActionParameters myParameters = JsonConvert.DeserializeObject<MyCustomActionParameters>(e.args.ToString());
string barcodeValue = myParameters.Value;

MemoryStream inputDocx, outputPDF = new MemoryStream();
e.docuVieware.GetDocumentData(out inputDocx);
using (GdPictureDocumentConverter oConv = new GdPictureDocumentConverter())
using (GdPicturePDF oPDF = new GdPicturePDF())
{
GdPictureStatus status = oConv.ConvertToPDF(inputDocx, GdPicture14.DocumentFormat.DocumentFormatDOCX, outputPDF, PdfConformance.Unknown);
oPDF.LoadFromStream(outputPDF);
if (oPDF.GetStat() == GdPictureStatus.OK)
{
oPDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
oPDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter);
BarcodePDF417EncodingMode EncodingMode = BarcodePDF417EncodingMode.BarcodePDF417EncodingModeUndefined;
BarcodePDF417ErrorCorrectionLevel CorrectionLevel = BarcodePDF417ErrorCorrectionLevel.BarcodePDF417ErrorCorrectionLevelAuto;
status = oPDF.DrawBarcodePDF417(barcodeValue, EncodingMode, CorrectionLevel, 0, 20, 0, 1, 1, 2, 2, Color.Black, Color.Transparent);
if (status == GdPictureStatus.OK)
{
e.message = new DocuViewareMessage("PDF417 agregado : " + status + ".", icon: DocuViewareMessageIcon.Ok);
}
else
{
e.message = new DocuViewareMessage("PDF417 no agregado : " + status + ".", icon: DocuViewareMessageIcon.Error);
}
e.docuVieware.RedrawPage();
}
else
{
e.message = new DocuViewareMessage("Error al convertir : " + status + ".", icon: DocuViewareMessageIcon.Error);
}
}
}

Hugo
Posts: 227
Joined: Tue Dec 18, 2018 10:09 am

Re: Error en insertar PDF417

Post by Hugo » Mon May 29, 2023 12:02 pm

Hi there,

Thank you for your question here.

Would you be able to confirm your issue persists in V14.2.28 please?
https://www.gdpicture.com/download-gdpicture/

If it does persist, could you provide me with a code project I can run as is, replicating the issue and allowing me to notice this on my end please?

Also in the meantime, to check if this is an issue on our end I'd suggest using a simpler code, something like below (and do not forget to load the file from oPDF in the viewer)

Code: Select all

string barcodeValue = "This is the value of my barcode";

MemoryStream inputDocx, outputPDF = new MemoryStream();
e.docuVieware.GetDocumentData(out inputDocx);
using (GdPictureDocumentConverter oConv = new GdPictureDocumentConverter())
using (GdPicturePDF oPDF = new GdPicturePDF())
{
    GdPictureStatus status = oConv.ConvertToPDF(inputDocx, GdPicture14.DocumentFormat.DocumentFormatDOCX, outputPDF, PdfConformance.Unknown);
    oPDF.LoadFromStream(outputPDF);
    if (oPDF.GetStat() == GdPictureStatus.OK)
    {
        oPDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
        oPDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter);
        BarcodePDF417EncodingMode EncodingMode = BarcodePDF417EncodingMode.BarcodePDF417EncodingModeUndefined;
        BarcodePDF417ErrorCorrectionLevel CorrectionLevel = BarcodePDF417ErrorCorrectionLevel.BarcodePDF417ErrorCorrectionLevelAuto;
        status = oPDF.DrawBarcodePDF417(barcodeValue, EncodingMode, CorrectionLevel, 0, 20, 0, 1, 1, 2, 2, Color.Black, Color.Transparent);
        if (status == GdPictureStatus.OK)
        {
            e.message = new DocuViewareMessage("PDF417 agregado : " + status + ".", icon: DocuViewareMessageIcon.Ok);
            e.docuVieware.LoadFromGdPicturePdf(oPDF);

        }
        else
        {
            e.message = new DocuViewareMessage("PDF417 no agregado : " + status + ".", icon: DocuViewareMessageIcon.Error);
        }
    }
    else
    {
        e.message = new DocuViewareMessage("Error al convertir : " + status + ".", icon: DocuViewareMessageIcon.Error);
    }
}
Regards,
Hugo Cudd
Technical Support

hillsshady
Posts: 1
Joined: Thu Jul 13, 2023 9:20 am
Contact:

Re: Error en insertar PDF417

Post by hillsshady » Thu Jul 13, 2023 9:22 am

We used an existing PDF417 barcode from the Adobe Forms object library. Multiple field values were combined into a single variable, which was then mapped to the barcode. We used the "CR_LF" attribute of the CL_ABAP_CHAR_UTILITIES class with the following combinations since we need "Carriage Return(CR)" as a field delimiter -

a. The entire "CR_LF" string is internally shown as '##' (hex - 0D000A00).
b. Used "CR_LF"+0(1), which was shown as a '#' (hex - 0D00).

When the bar code is scanned using legacy barcode scanners and the data is decoded, we see that the delimiter is Line Feed (hex - 0A00) rather than CR (hex - 0D00) in both of the above circumstances.

Please let us know if you have encountered a similar problem. Please offer your ideas for making the delimiter Carriage Return (hex - 0D; dec - 13) rather than Line Feed (hex - 0A; dec - 10).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest