Hi, in Stata 14, it is now possible to create a PDF using mata, something I appreciate very much.
But, I am struggling to get the 'basics' to work. For example, with this code, from the documentation:
Mata does create a PDF in the current working directory. This is straightforward.
So, now I want to set some document specifics, like the page size, which requires the PdfDocument class command setPageSize(sz)which I have coded as:
But this results in an error:
<istmt>: 3499 A4 not found
(5 lines skipped)
Does anyone know what goes wrong here, or if am not correctly coding?
Best regards,
Eric
{Note that I posted this question earlier but in the wrong Forum}
But, I am struggling to get the 'basics' to work. For example, with this code, from the documentation:
Code:
mata:
pdf = PdfDocument()
p = PdfParagraph()
p.addString("This is our first example of a paragraph. ")
p.addString("Let's add another sentence. ")
p.addString("Now we will conclude our first paragraph.")
pdf.addParagraph(p)
pdf.save("WorkingExample1.pdf")
pdf.close()
* clean up
mata drop p
mata drop pdf
end
So, now I want to set some document specifics, like the page size, which requires the PdfDocument class command setPageSize(sz)which I have coded as:
Code:
pdf.setPageSize(A4)
Code:
mata:
pdf = PdfDocument()
p = PdfParagraph()
p.addString("This is our first example of a paragraph. ")
p.addString("Let's add another sentence. ")
p.addString("Now we will conclude our first paragraph.")
pdf.addParagraph(p)
pdf.setPageSize(A4)
pdf.save("WorkingExample1.pdf")
pdf.close()
* clean up
mata drop p
mata drop pdf
end
<istmt>: 3499 A4 not found
(5 lines skipped)
Does anyone know what goes wrong here, or if am not correctly coding?
Best regards,
Eric
{Note that I posted this question earlier but in the wrong Forum}

Comment