Last active
May 19, 2021 11:24
-
-
Save GroupDocsGists/b19804d541cddbe28869fd02e067c42a to your computer and use it in GitHub Desktop.
Convert Images to PDF in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert any Image to PDF in C#. PNG, WebP, JPG, GIF, TGA and many more ... | |
using (Converter converter = new Converter("image.png")) | |
{ | |
PdfConvertOptions options = new PdfConvertOptions(); | |
converter.Convert("imageToPdf.pdf", options); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert JPG, PNG or other Images to PDF in C#. Resize, Set margins, or rotate images. | |
using (Converter converter = new Converter("image.jpg")) | |
{ | |
PdfConvertOptions options = new PdfConvertOptions | |
{ | |
Width = 233, | |
Height = 175, | |
MarginTop = 20, | |
MarginBottom = 20, | |
MarginLeft = 20, | |
MarginRight = 20, | |
Rotate = Rotation.On180 | |
}; | |
converter.Convert("imageToPdfAdv.pdf", options); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert JPG Image to PDF in C# | |
using (Converter converter = new Converter("image.jpg")) | |
{ | |
PdfConvertOptions options = new PdfConvertOptions(); | |
converter.Convert("imageToPdf.pdf", options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment