Skip to content

How to set the culture of the PDF converter? #8635

@IllimarAtShareCloud

Description

@IllimarAtShareCloud

What type of issue is this?

Question

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Target SharePoint environment

SharePoint Online

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

No response

Issue description

So we are leveraging the PDF converter .pdfConversionUrl found in in the ListSchema in one of our solution.

Sry hard to explain, because I was not the orginal author, then I do not exactly know the terms, but here is the code:

const viewXml: string = `
                <View Scope='RecursiveAll'>
                    <Query>
                        <Where>
                            <In>
                                <FieldRef Name='ID' />
                                <Values>
                                    <Value Type='Counter'>${file.itemId}</Value>
                                </Values>
                            </In>
                        </Where>
                    </Query>
                    <RowLimit>1</RowLimit>
                </View>
            `;

            let response = await sp.web.lists.getById(file.listId).renderListDataAsStream({ RenderOptions: options, ViewXml: viewXml }) as any;
            // "{.mediaBaseUrl}/transform/pdf?provider=spo&inputFormat={.fileType}&cs={.callerStack}&docid={.spItemUrl}&{.driveAccessToken}"
            
            let pdfConversionUrl = response.ListSchema[".pdfConversionUrl"];
            let mediaBaseUrl = response.ListSchema[".mediaBaseUrl"];
            let callerStack = response.ListSchema[".callerStack"];
            let driveAccessToken = response.ListSchema[".driveAccessToken"];
            
            response.ListData.Row.forEach(element => {
                let fileType = element[".fileType"];
                let spItemUrl = element[".spItemUrl"];
                let pdfUrl = pdfConversionUrl
                    .replace("{.mediaBaseUrl}", mediaBaseUrl)
                    .replace("{.fileType}", fileType)
                    .replace("{.callerStack}", callerStack)
                    .replace("{.spItemUrl}", spItemUrl)
                    .replace("{.driveAccessToken}", driveAccessToken)
                ;
                let pdfFileName = element.FileLeafRef.replace(fileType, "pdf");
    
                const pdfFile:ISharePointPdFConversionFile = {
                    serverRelativeUrl: element["FileRef"], 
                    pdfUrl: pdfUrl, 
                    fileType: fileType, 
                    pdfFileName: pdfFileName,
                    fileSize: parseFloat(element['File_x0020_Size']),
                    sourceUniqueId: file.uniqueId
                };
                
                ret.push(pdfFile);
            });

Anyway, the endpoint works fine as expected, it is just when converting the Excel files into PDF-s then the date format is always what I assume to be en-US however the site that we are using is ee-ET

Is there a way to set the culture of the converter? I could not find anything on the issue on the wider web.

The closest thing I could find is the Graph API, with uses the same endpoint (at least according to one blog) and there nothing is said about how to set the culture:
https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APItype:archive-old-issueIssues which are closed as tool old for active work

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions