We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Empty path name is not legal - Converting PDF to PDF A in Azure

Hi All,

I’m tryng to convert, a PDF to PDF/A in a Azure function (.net core 3.1), i’m using memory streams both for reading file and for saving.

The convert operation fails with this error: “Empty path name is not legal. (Parameter ‘path’)”.

The exact same code, with the exact same PDF as imput, work well in a console application (.net core 3.1) using file stream instead of memory stream.

I’m using ASPOSE.PDF 22.3.0.

    public byte[] ConvertToPdfA(Stream pdfToConvert)
    {
        log = string.Empty;
        Document pdfDocument = new Document(pdfToConvert);
        using (var logStream = new MemoryStream()){
            
            try {
                pdfDocument.Convert(log, PdfFormat.PDF_A_2B, ConvertErrorAction.Delete);
            }catch(Exception e)
            {
                log = System.Text.Encoding.Default.GetString(logStream.ToArray());
                throw e;
            }

            log = System.Text.Encoding.Default.GetString(logStream.ToArray());
        }
        byte[] resultArray;
        using (MemoryStream result = new MemoryStream())
        {
            pdfDocument.Save(result);
            resultArray = result.ToArray();
        }
        return resultArray;
    }

Regards
M

@Mario_S

Are you facing this issue with particular PDF document or with all PDF files that is being processed? Can you please share a sample PDF document for our reference so that we can try to replicate the issue in our environment and address it accordingly?

I got the error, with any of the PDF i tried (attached the simplest one). As i say the conversion works from console, and does not work on a azure function (both, deployed on azure and locally on my PC).
Sample_90105.pdf (15.0 KB)

@Mario_S

We have logged an investigation ticket as PDFNET-51689 in our issue tracking system to further analyze this case. We will further 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.