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

Include Image in Adobe PDF Services API

Community Beginner ,
Sep 12, 2022 Sep 12, 2022

Copy link to clipboard

Copied

Hi 

How to Include Image while downloading as pdf using Adobe PDF Services API.I'm using .NET SDK.

Can someone help me to overcome this ? I'm getting image as empty eventhough its present in the repective folder.

vijay25451983uagu_0-1662991773843.png

 

Views

308

Translate

Translate

Report

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
Adobe Employee ,
Sep 12, 2022 Sep 12, 2022

Copy link to clipboard

Copied

Hi, I need a lot more detail to help you out. Can you explain how you are using the PDF Services API? I assume you are generating a PDF from something, but you need to provide more information. 

Votes

Translate

Translate

Report

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
Community Beginner ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

Hi Im using .net sdk . Here I'm trying to export pdf by generating my own HTML by clicking the Export button, Iam able to export the pdf with data which is genearted by HTML.Everything works perfect but Im not able to add imags in the pdf

Credentials credentials = Credentials.ServiceAccountCredentialsBuilder().WithClientId("Client Id")
.WithClientSecret("Secret") // using Environmental variables from azure key vault
.WithPrivateKey("PrivateKey")
.WithOrganizationId("orgId")
.WithAccountId("AccountId")
.Build();
//Create an ExecutionContext using credentials and create a new operation instance.
Adobe.PDFServicesSDK.ExecutionContext executionContext = Adobe.PDFServicesSDK.ExecutionContext.Create(credentials);
CreatePDFOperation htmlToPDFOperation = CreatePDFOperation.CreateNew();

string ExportData = ExportDatatableToHtml(dssample.Tables[0]);
byte[] exportArray = Encoding.UTF8.GetBytes(ExportData);


MemoryStream stream = new MemoryStream(exportArray);

htmlToPDFOperation.SetInput(FileRef.CreateFromStream(stream, CreatePDFOperation.SupportedSourceFormat.HTML.GetMediaType()));

SetCustomOptions(htmlToPDFOperation);

// Execute the operation.
var result = htmlToPDFOperation.Execute(executionContext);
using (MemoryStream outputStream = new MemoryStream())
{

result.SaveAs(outputStream);

return File(outputStream.ToArray(),
"application/pdf", "Sample");
}

ExportDatatableToHtml
=================================

StringBuilder strHTMLBuilder = new StringBuilder();
strHTMLBuilder.Append("<html>");
strHTMLBuilder.Append("<head>");
strHTMLBuilder.Append("</head>");
strHTMLBuilder.Append("<body>");

strHTMLBuilder.Append("<table width='100%' align='right'><tr><td align='right'><img src='"+ sPath + "/assets/mylogo.png' ></img></td></tr></table>");

strHTMLBuilder.Append("<body>");
strHTMLBuilder.Append("</head>");
strHTMLBuilder.Append("<head>");
strHTMLBuilder.Append("<html>");

Votes

Translate

Translate

Report

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
Adobe Employee ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

LATEST

According to the docs, when you do HTML to PDF, you send in a zip of the HTML + asserts. It's hard to read your code above, but you appear to be sending just an HTML string. See the .Net example here - https://developer.adobe.com/document-services/docs/overview/pdf-services-api/howtos/create-pdf/#crea...

Votes

Translate

Translate

Report

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
Resources