Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Create PDF from HTML

New Here ,
Jun 09, 2021 Jun 09, 2021

We have created a document in HTML and used CSS to resize it to the size of an A5 document. If we call the API via the create request and set the key "contentAnalyzerRequests" in the body with the following value:

 

{
	"cpf:inputs": {
		"params": {
			"cpf:inline": {
				"print": {
					"includeHeaderFooter": true
				},
				"pageLayout": {
					"pageHeight": 5.8,
					"pageWidth": 8.3
				},
				"json": "{\"k1\": \"v1\", \"k2\": \"v2\"}"
			}
		},
		"documentIn": {
			"cpf:location": "InputFile0",
			"dc:format": "application/zip"
		}
	},
	"cpf:engine": {
		"repo:assetId": "urn:aaid:cpf:Service-e2ee120a2b06427cb449592f5db967e7"
	},
	"cpf:outputs": {
		"documentOut": {
			"cpf:location": "multipartLabelOut",
			"dc:format": "application/pdf"
		}
	}
}

We get the following response back:

{
	"cpf:inputs": {
		"params": {
			"cpf:inline": {
				"print": {
					"includeHeaderFooter": true
				},
				"pageLayout": {
					"pageHeight": 5.8,
					"pageWidth": 8.3
				},
				"json": "{\"k1\": \"v1\", \"k2\": \"v2\"}"
			}
		},
		"documentIn": {
			"cpf:location": "InputFile0",
			"dc:format": "application/zip"
		}
	},
	"cpf:engine": {
		"repo:assetId": "urn:aaid:cpf:Service-e2ee120a2b06427cb449592f5db967e7"
	},
	"cpf:outputs": {
		"documentOut": {
			"cpf:location": "multipartLabelOut",
			"dc:format": "application/pdf"
		}
	}
}

 

but then when we do the get-reuqest "poll" we get the PDF document as an A4 document. The upper half is our desired content and below it a white-gray block to fill the A4 document. Here is the response of the pull-request:

 

{
   "cpf:inputs":{
      "params":{
         "cpf:inline":{
            "print":{
               "includeHeaderFooter":true
            },
            "pageLayout":{
               "pageHeight":5.8,
               "pageWidth":8.3
            },
            "json":"{\"k1\": \"v1\", \"k2\": \"v2\"}"
         }
      },
      "documentIn":{
         "cpf:location":"InputFile0",
         "dc:format":"application/zip"
      }
   },
   "cpf:engine":{
      "repo:assetId":"urn:aaid:cpf:Service-e2ee120a2b06427cb449592f5db967e7"
   },
   "cpf:status":{
      "completed":true,
      "type":"",
      "status":200
   },
   "cpf:outputs":{
      "documentOut":{
         "cpf:location":"multipartLabelOut",
         "dc:format":"application/pdf"
      }
   }
}
TOPICS
Document Generation API
273
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources