Page MenuHomePhabricator

[Spike 8hrs] How should the new print styles be applied to single-article ("save as PDF") PDFs?
Closed, InvalidPublic

Description

We'd like to apply new print styles to single PDFs rendered with electron and deploy to the staging environment. The question is how should we do it?

A/C

Delivery questions:

  • How should the new print styles be applied to single-article PDFs? Should they be done on the service layer or in PHP
  • What changes are needed to support incorporating styles into the PDF? Will styles be applied inside Electron or in a pre-processing step or another service?

Vector questions:

  • How does this get impacted by the Vector feature flagWill styles be applied inside Electron or in a pre-processing step?
  • Should we promote the existing feature flagged print styles (aka new print styles) so that both regular website users and electron see the same print styles and there won't be need to work out a special case for electron?

Output

  • Create task(s) for applying the styles with the guidelines and requirements from the questions above
NOTE: The desktop or mobile print styles for the article will be delivered, depending on the user's device. See T163472: [EPIC] Provide a way to download articles in PDF on the mobile website for more info on PDFs on mobile

Event Timeline

ovasileva changed the task status from Open to Stalled.Jul 28 2017, 2:06 PM
ovasileva triaged this task as High priority.
ovasileva created this task.
phuedx renamed this task from Apply new PDF styles to single-article PDFs to Apply new PDF styles to single-article PDFs on the Beta Cluster.Aug 2 2017, 7:53 AM
ovasileva changed the task status from Stalled to Open.Aug 29 2017, 12:09 PM
Jdlrobson changed the task status from Open to Stalled.Aug 29 2017, 4:50 PM
Jdlrobson moved this task from Incoming to Needs Prioritization on the Readers-Web-Backlog board.
Jdlrobson added a subscriber: Jdlrobson.

I think stalled was probably more appropriate. We need to make this possible first... there's nothing to deploy right now. T150871 talks about the approach but we haven't gone ahead and made that happen yet (unless I'm mistaken).

@Jdlrobson - this is about applying the print styles to the PDFs, and then T171956: Allow PDF rendering to be triggered only by electron for single-article PDFs is about deploying them - do we need another task in-between? A spike maybe?

to be turned into a spike - How should the new print styles be applied to single-article PDFs?

We realised there are lots of things we need to work out for this before we implement

  • How does this get impacted by the Vector feature flag?
  • How should the new print styles be applied to single-article PDFs?
  • Will styles be applied inside Electron or in a pre-processing step?
ovasileva changed the task status from Stalled to Open.Aug 30 2017, 4:23 PM
bmansurov renamed this task from Apply new PDF styles to single-article PDFs on the Beta Cluster to [Spike] How should the new print styles be applied to single-article PDFs?.Aug 30 2017, 5:33 PM
bmansurov added a project: Spike.
bmansurov updated the task description. (Show Details)

I think all these questions hinge on how we apply the styles.
https://en.wikipedia.org/api/rest_v1/#!/Page_content/get_page_pdf_title currently only takes a title parameter.

If we apply styles inside Electron, we'll need to send an additional parameter which would be either

  • css - the css to apply to the pdf
  • list of ResourceLoader module names - so the service could obtain styles from ResourceLoader
  • a skin name - e.g. 'vector' that the service uses to retrieve the needed stylesheets

If we apply styles in PHP and create a <style> tag inside the HTML output, this becomes much easier.

I'm not worried about the Vector feature flag. The Vector print styles module is available even with the feature flag disabled.

Should we promote the existing feature flagged print styles

Yes. I'd hope we deploy this before the OCG roll out. It seems like an important precursor.

ovasileva renamed this task from [Spike] How should the new print styles be applied to single-article PDFs? to [Spike] How should the new print styles be applied to single-article ("save as PDF") PDFs?.Sep 5 2017, 4:15 PM
Jdlrobson renamed this task from [Spike] How should the new print styles be applied to single-article ("save as PDF") PDFs? to [Spike] How should the new print styles be applied to single-article PDFs?.Sep 5 2017, 4:18 PM
Jdlrobson updated the task description. (Show Details)
ovasileva renamed this task from [Spike] How should the new print styles be applied to single-article PDFs? to [Spike 8hrs] How should the new print styles be applied to single-article ("save as PDF") PDFs?.Sep 5 2017, 4:22 PM
ovasileva updated the task description. (Show Details)

According to @bmansurov Electron already includes print styles for the skin so really the question is whether we need to roll out the new print styles before.

If we were to deploy the new print styles everywhere prior to launching Proton, then we can simply resolve this task as there'll be no work required. @ovasileva: Is this feasible?

/cc @bmansurov

If we were to deploy the new print styles everywhere prior to launching Proton, then we can simply resolve this task as there'll be no work required. @ovasileva: Is this feasible?

/cc @bmansurov

I think that's possible, but depends on T169730: Define and implement instrumentation for printing on desktop web. If we can start gathering data this week, we would need approximately 2 weeks of data prior to deploying the print styles. That still leaves us on-schedule. What would be required if we deploy the print styles first?

I think that's possible, but depends on T169730: Define and implement instrumentation for printing on desktop web. If we can start gathering data this week, we would need approximately 2 weeks of data prior to deploying the print styles.

The size of that task makes this timeline unlikely.

What would be required if we deploy the print styles first?

Did you mean to ask "if we don't deploy the print styles first?"? If so, then that's what this task is asking.

>> What would be required if we deploy the print styles first?

Did you mean to ask "if we don't deploy the print styles first?"? If so, then that's what this task is asking.

No, I did mean if we deploy the print styles first. I think we can have a short lag between retiring OCG and deploying the new styles - there's no significant issues with the electron styles as of now. Anyhow, let me rephrase - if we close this task, what is the task we should open if working under the assumption that we are deploying the print styles first? Or is there nothing to be done?

Anyhow, let me rephrase - if we close this task, what is the task we should open if working under the assumption that we are deploying the print styles first? Or is there nothing to be done?

AFAIK there's nothing to be done. We discussed this during the last kick off ritual and that led to me writing T171957#3585565. @bmansurov: Is this correct?

Yes, that's correct. As long as the new print styles are the default, we don't need to do anything extra to get them applied to Electron rendered pages.

Ok, we can wait on this until we have the print styles out everywhere. However T171956: Allow PDF rendering to be triggered only by electron for single-article PDFs will not be blocked on print styles deployment.