comparison Sphinx/source/users/advanced-rest.rst @ 226:eaae8d630277

proofreading of pdf
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 06 Mar 2019 10:44:38 +0100
parents ced9dbf86de8
children 08c47b8abeea
comparison
equal deleted inserted replaced
225:ced9dbf86de8 226:eaae8d630277
66 .. _pdf: 66 .. _pdf:
67 67
68 PDF 68 PDF
69 --- 69 ---
70 70
71 Among many different types of data, DICOM files can be used to store PDF files. The ``create-dicom`` API route can be used to upload a PDF file to Orthanc. 71 Among many different types of data, DICOM files can be used to store
72 72 PDF files. The ``/tools/create-dicom`` URI can be used to upload a PDF
73 The following scripts perform such a *dicomization* ; they convert the ``HelloWorld2.pdf`` file to base64, then perform a ``POST`` request with JSON data containing the converted payload. 73 file to Orthanc. The following scripts perform such a *DICOM-ization*;
74 They convert the ``HelloWorld2.pdf`` file to base64, then perform a
75 ``POST`` request with JSON data containing the converted payload.
74 76
75 Using bash:: 77 Using bash::
76 78
77 # create the json data, with the BASE64 data embedded in it 79 # create the json data, with the BASE64 data embedded in it
78 (echo -n '{"Tags" : {"PatientName" : "Benjamino", "Modality" : "CT"},"Content" : "data:application/pdf;base64,'; base64 HelloWorld2.pdf; echo '"}') > /tmp/foo 80 (echo -n '{"Tags" : {"PatientName" : "Benjamino", "Modality" : "CT"},"Content" : "data:application/pdf;base64,'; base64 HelloWorld2.pdf; echo '"}') > /tmp/foo
92 $reply = Invoke-WebRequest -Uri http://localhost:8042/tools/create-dicom -Method POST -Body ($params|ConvertTo-Json) -ContentType "application/json" | ConvertFrom-Json 94 $reply = Invoke-WebRequest -Uri http://localhost:8042/tools/create-dicom -Method POST -Body ($params|ConvertTo-Json) -ContentType "application/json" | ConvertFrom-Json
93 95
94 # display the result 96 # display the result
95 Write-Host "The instance can be retrieved in PDF at http://localhost:8042$($reply.Path)/pdf" 97 Write-Host "The instance can be retrieved in PDF at http://localhost:8042$($reply.Path)/pdf"
96 98
97 Please note that the `create-dicom` API call will return the Orthanc instance ID of the newly created DICOM resource. You can then use the ``http://localhost:8042/<INSTANCE-ID>/pdf`` route to request the stored file as PDF. 99 Please note that the ``/tools/create-dicom`` API call will return the
100 Orthanc instance ID of the newly created DICOM resource.
101
102 You can use the ``/instances/.../pdf`` URI to retrieve an embedded PDF
103 file.