Rosh
Rosh

Reputation: 55

PDFLib fails to create PDF file in pvf

mpdf.create_pvf(card, mpImgBytes, mlen, L"");
int inDoc = mpdf.open_pdi_document(card, L"");

I am using pdflib version 9.3.

open_pdi_document returns -1

create_pvf creates an empty file of size 0. Any idea on what could be wrong?

I am running pdflib on Windows 10, using C++.

Upvotes: 0

Views: 310

Answers (2)

Rosh
Rosh

Reputation: 55

Not sure how relevant my answer is, but this could help someone.

Installing ghostscript on my machine, resolved the error.

Upvotes: 0

Rainer
Rainer

Reputation: 2185

I would recommend that you also retrieve the error reason in case of an error (open_pdi_document() returns -1) or work with the PDFlib errorpolicy "exception". Then you will get a first impression what the problem might be, then your code could looks like

        /* Open the input PDF */
        indoc = mpdf.open_pdi_document(card, L"");
        if (indoc == -1) {
            wcerr << L"Error: " << mpdf.get_errmsg() << endl;
            return 2;
        }

create_pvf creates an empty file of size 0.

how did you identify that?

Upvotes: 3

Related Questions