Convert to PDF
Portable Document Format. The API converts 112 formats to PDF. These are the options, by input format.
curl https://api.switchfile.io/v1/convert \
-H "Authorization: Bearer $SWITCHFILE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/input.3fr","to":"pdf","options":{"quality":80}}'const res = await fetch("https://api.switchfile.io/v1/convert", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SWITCHFILE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"url":"https://example.com/input.3fr","to":"pdf","options":{"quality":80}}),
});
console.log(await res.json());From 29 formats
qualityintegerdefault: 90Compression quality from 1 (smallest file) to 100 (best quality).
1 to 100
widthintegerdefault: not setWidth of the image in pixels.
1 to 65535 px
heightintegerdefault: not setHeight of the image in pixels.
1 to 65535 px
fitenumdefault: max"max" fits inside width and height without enlarging, "upscale" may enlarge, "crop" fills and crops, "scale" stretches to the exact size.
one of max, upscale, crop, scale
stripbooleandefault: falseRemove metadata such as camera data and location.
auto_orientbooleandefault: trueRotate the image upright according to its EXIF orientation.
From 16 formats
pagesstringdefault: not setPage range, for example 1-3 or 1,3,5.
pdf_abooleandefault: falseCreate PDF/A-1b for long-term archiving.
optimize_printbooleandefault: trueKeep images at full resolution for printing. Set to false for smaller files for the screen (images at 150 dpi).
bookmarksbooleandefault: not setAdd bookmarks for headings. Without a value bookmarks are added.
passwordstringdefault: not setPassword to open the file.
From 14 formats
widthintegerdefault: not setWidth of the image in pixels.
1 to 65535 px
heightintegerdefault: not setHeight of the image in pixels.
1 to 65535 px
fitenumdefault: max"max" fits inside width and height without enlarging, "upscale" may enlarge, "crop" fills and crops, "scale" stretches to the exact size.
one of max, upscale, crop, scale
stripbooleandefault: falseRemove metadata such as camera data and location.
auto_orientbooleandefault: trueRotate the image upright according to its EXIF orientation.
From 11 formats
page_formatenumdefault: a4Paper size of the PDF.
one of a4, letter, a5, a3, legal
From 11 formats
pagesstringdefault: not setPage range, for example 1-3 or 1,3,5.
pdf_abooleandefault: falseCreate PDF/A-1b for long-term archiving.
optimize_printbooleandefault: trueKeep images at full resolution for printing. Set to false for smaller files for the screen (images at 150 dpi).
bookmarksbooleandefault: not setAdd bookmarks for headings. Without a value bookmarks are added.
hidden_slidesbooleandefault: falseInclude hidden slides.
passwordstringdefault: not setPassword to open the file.
From 10 formats
pagesstringdefault: not setPage range, for example 1-3 or 1,3,5.
pdf_abooleandefault: falseCreate PDF/A-1b for long-term archiving.
optimize_printbooleandefault: trueKeep images at full resolution for printing. Set to false for smaller files for the screen (images at 150 dpi).
bookmarksbooleandefault: not setAdd bookmarks for headings. Without a value bookmarks are added.
include_markupbooleandefault: falseInclude comments in the page margin.
passwordstringdefault: not setPassword to open the file.
From 4 formats
widthintegerdefault: not setWidth of the image in pixels.
1 to 65535 px
heightintegerdefault: not setHeight of the image in pixels.
1 to 65535 px
fitenumdefault: max"max" fits inside width and height without enlarging, "upscale" may enlarge, "crop" fills and crops, "scale" stretches to the exact size.
one of max, upscale, crop, scale
stripbooleandefault: falseRemove metadata such as camera data and location.
auto_orientbooleandefault: trueRotate the image upright according to its EXIF orientation.
pagesstringdefault: not setPages, frames or layers to convert, for example 1-3,5 or all. Without it, only the first page, frame or layer is converted.
From 3 formats
qualityintegerdefault: 90Compression quality from 1 (smallest file) to 100 (best quality).
1 to 100
widthintegerdefault: not setWidth of the image in pixels.
1 to 65535 px
heightintegerdefault: not setHeight of the image in pixels.
1 to 65535 px
fitenumdefault: max"max" fits inside width and height without enlarging, "upscale" may enlarge, "crop" fills and crops, "scale" stretches to the exact size.
one of max, upscale, crop, scale
stripbooleandefault: falseRemove metadata such as camera data and location.
auto_orientbooleandefault: trueRotate the image upright according to its EXIF orientation.
pagesstringdefault: not setPages, frames or layers to convert, for example 1-3,5 or all. Without it, only the first page, frame or layer is converted.
From 2 formats
widthintegerdefault: not setWidth of the image in pixels.
1 to 65535 px
heightintegerdefault: not setHeight of the image in pixels.
1 to 65535 px
fitenumdefault: max"max" fits inside width and height without enlarging, "upscale" may enlarge, "crop" fills and crops, "scale" stretches to the exact size.
one of max, upscale, crop, scale
stripbooleandefault: falseRemove metadata such as camera data and location.
auto_orientbooleandefault: trueRotate the image upright according to its EXIF orientation.
pagesstringdefault: not setPages, frames or layers to convert, for example 1-3,5 or all. Without it, the largest icon in the file is converted.
From 2 formats
page_formatenumdefault: not setPaper size. Without a value A4 is used unless the page sets its own size.
one of a4, letter, a3, a5, legal, tabloid
landscapebooleandefault: falseLandscape orientation.
marginstringdefault: not setPage margin, for example 15mm, 1in or 20px.
print_backgroundbooleandefault: truePrint background colors and images.
From 2 formats
widthintegerdefault: not setWidth of the image in pixels.
1 to 65535 px
heightintegerdefault: not setHeight of the image in pixels.
1 to 65535 px
fitenumdefault: max"max" fits inside width and height without enlarging, "upscale" may enlarge, "crop" fills and crops, "scale" stretches to the exact size.
one of max, upscale, crop, scale
stripbooleandefault: falseRemove metadata such as camera data and location.
auto_orientbooleandefault: trueRotate the image upright according to its EXIF orientation.
pagesstringdefault: not setPages, frames or layers to convert, for example 1-3,5 or all. Without it, all pages or frames are converted.
From CSV
delimiterstringdefault: ,Field separator of the input file: one character or comma, semicolon, tab, pipe, space.
encodingstringdefault: utf-8Text encoding of the input file, for example utf-8, windows-1252, iso-8859-1 or utf-16.
pagesstringdefault: not setPage range, for example 1-3 or 1,3,5.
pdf_abooleandefault: falseCreate PDF/A-1b for long-term archiving.
optimize_printbooleandefault: trueKeep images at full resolution for printing. Set to false for smaller files for the screen (images at 150 dpi).
bookmarksbooleandefault: not setAdd bookmarks for headings. Without a value bookmarks are added.
passwordstringdefault: not setPassword to open the file.
From SVG
widthintegerdefault: not setWidth of the image in pixels.
1 to 65535 px
heightintegerdefault: not setHeight of the image in pixels.
1 to 65535 px
fitenumdefault: max"max" fits inside width and height without enlarging, "upscale" may enlarge, "crop" fills and crops, "scale" stretches to the exact size.
one of max, upscale, crop, scale
stripbooleandefault: falseRemove metadata such as camera data and location.
auto_orientbooleandefault: trueRotate the image upright according to its EXIF orientation.
pixel_densityintegerdefault: 72Resolution in pixels per inch the drawing is rendered at.
From TSV
delimiterstringdefault: tabField separator of the input file: one character or comma, semicolon, tab, pipe, space.
encodingstringdefault: utf-8Text encoding of the input file, for example utf-8, windows-1252, iso-8859-1 or utf-16.
pagesstringdefault: not setPage range, for example 1-3 or 1,3,5.
pdf_abooleandefault: falseCreate PDF/A-1b for long-term archiving.
optimize_printbooleandefault: trueKeep images at full resolution for printing. Set to false for smaller files for the screen (images at 150 dpi).
bookmarksbooleandefault: not setAdd bookmarks for headings. Without a value bookmarks are added.
passwordstringdefault: not setPassword to open the file.
From TXT
encodingstringdefault: utf-8Text encoding of the input file, for example utf-8, windows-1252, iso-8859-1 or utf-16.
pagesstringdefault: not setPage range, for example 1-3 or 1,3,5.
pdf_abooleandefault: falseCreate PDF/A-1b for long-term archiving.
optimize_printbooleandefault: trueKeep images at full resolution for printing. Set to false for smaller files for the screen (images at 150 dpi).
bookmarksbooleandefault: not setAdd bookmarks for headings. Without a value bookmarks are added.
include_markupbooleandefault: falseInclude comments in the page margin.
passwordstringdefault: not setPassword to open the file.
From 4 formats
No options. The file is converted with the usual settings for PDF.