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: 211
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

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests