Rest - Get Form as PDF

15 views
Skip to first unread message

Joel Oates

unread,
Aug 24, 2020, 4:19:14 AM8/24/20
to orb...@googlegroups.com
Hello,

I have a document that has previously been filled out and saved, I want to
extract the PDF of that document via the REST interface.

I have been looking through the documentation and haven't found a way of
achieving this..

is it possible to get the generated pdf (same as the PDF button) from the
CRUD or Persistence API?

Thanks,
Joel.

--
Sent from: http://discuss.orbeon.com/

Alessandro Vernet

unread,
Aug 24, 2020, 6:58:28 PM8/24/20
to orb...@googlegroups.com
Hi Joel,

Say your form is accessible through:


http://localhost:8080/orbeon/fr/a/a/edit/a4451a08bf8d666ac54e572ef11edce5ae183fcd

Then you get the PDF by accessing the following, i.e. just replacing `edit`
by `pdf`. You'll let me know if this works for you.


http://localhost:8080/orbeon/fr/a/a/pdf/a4451a08bf8d666ac54e572ef11edce5ae183fcd

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Joel Oates

unread,
Aug 24, 2020, 9:44:26 PM8/24/20
to orb...@googlegroups.com
Worked a Treat!

Thanks Alex!

I couldn't seem to find it in the documentation..

Joel Oates

unread,
Aug 25, 2020, 12:05:44 AM8/25/20
to orb...@googlegroups.com
Just a Follow up question here..

If I wanted to get the PDF document as a PDF (Via postman or in Code) I get
the response

`This response could not be previewed. Download the response to open it with
an appropriate application.`

Is there a way I can get this response as a file? or some way of saving it?


Joel

Alessandro Vernet

unread,
Aug 26, 2020, 12:16:47 AM8/26/20
to orb...@googlegroups.com
Hi Joel,

Is that may be an error from Postman? If I run the following command (where
`123` is my document id), I do get the expected PDF in `file.pdf`. If you're
getting a different result, how can I reproduce that?

curl --output file.pdf http://localhost:8080/orbeon/fr/a/a/pdf/123

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Joel Oates

unread,
Aug 26, 2020, 8:21:32 PM8/26/20
to orb...@googlegroups.com
Hi Alex,

Seemed to be an issue with Postman..

Thanks,
Joel

Alessandro Vernet

unread,
Aug 27, 2020, 8:31:59 PM8/27/20
to orb...@googlegroups.com
Got it Joel, this is reassuring, and thank you for the confirmation.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply all
Reply to author
Forward
0 new messages