Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiple pages #4

Closed
N30NF15H opened this issue Jun 5, 2018 · 3 comments
Closed

Handle multiple pages #4

N30NF15H opened this issue Jun 5, 2018 · 3 comments
Assignees

Comments

@N30NF15H
Copy link

N30NF15H commented Jun 5, 2018

Library has worked well for me so far, is there any plan to support multiple urls for a combination into a single PDF?

I've been using the following method which requires some specific ordering of parameters to get the required outcome for multiple web pages.

var config = new Shark.PdfConvert.PdfConversionSettings
{
Title = "Combined PDF",
ContentUrl = "thirdurlrequired" //Will render as last pages in PDF
}

var customArgs = new List();
customArgs.Add("--javascript-delay 1000");
customArgs.Add("--print-media-type");
customArgs.Add(string.Format("page \"{0}\" ", "firsturlrequired")); //Additional pages must come as last args, first url will render as first doc etc
customArgs.Add(string.Format("page \"{0}\" ", "secondurlrequired"));
config.CustomWkHtmlArgs = string.Join(" ", customArgs);

@cp79shark
Copy link
Owner

I added a ContentUrls option to PdfConversionSettings and a quick test for it. Seems to work. You can pull from source if you want to try it right away. I'll posted an updated NuGet package and it should be visible in a little while.

@cp79shark cp79shark self-assigned this Jun 5, 2018
@N30NF15H
Copy link
Author

N30NF15H commented Jun 5, 2018

Dude that was fast, appreciate it. Just gave it a test, getting an error about assignment only. Had a look at the property and it only has a get function, am I assigning it incorrectly?

public ICollection ContentUrls { get; }

@cp79shark
Copy link
Owner

No problem, needed a quick distraction from the day job.

See Sample 6 on the main page. It's a collection.

settings.ContentUrls.Add(your_url);
settings.ContentUrls.Add(your_other_url);

or if you're using Linq

settings.ContentUrls.AddRange(my_url_collection);

Anything else on this, then I can re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants