Gitbook to PDF - Tables columns are getting cut-off - gitbook

When generating a pdf(and also in the website), columns are getting cut-off. This is possible to fix with css in the website but not in PDF.
Is there any solution to this problem?

book.json file update paperSize is a3
"pdf": {
"pageNumbers": true,
"fontSize": 12,
"paperSize": "a3",
"margin": {
"right": 62,
"left": 62,
"top": 36,
"bottom": 36
},
"headerTemplate": null,
"footerTemplate": null
}

Related

I have a list of Dictionaries each dictionary got a value assigned to a key and I need to grab this value according to other 2 values

This is the list{'id': 142840, 'posters': [{'aspect_ratio': 0.703125, 'file_path': '/4EFI8IdI7LOm9Q0BTT2FAdPwdeq.jpg', 'height': 2048, 'iso_639_1': 'en', 'vote_average': 5.312, 'vote_count': 1, 'width': 1440}, {'aspect_ratio': 0.70703125, 'file_path': '/2Lgb7oPgqVpJmruRoH7Rs2yJH0n.jpg', 'height': 2048, 'iso_639_1': 'en', 'vote_average': 5.172, 'vote_count': 1, 'width': 1448}, {'aspect_ratio': 0.7068881289692233, 'file_path': '/6mLaG60xEQm6mw0Ga8TDFZsk0R1.jpg', 'height': 2047, 'iso_639_1': None, 'vote_average': 0.0, 'vote_count': 0, 'width': 1447}]}
I am trying to pick the value of file_path if height>width
It often helps to format a complex data structure to better see how the pieces relate. In this case it shows that the information you care about (height, width, and file_path) can all be found in the dictionaries inside the posters list which is inside a dict we can call poster_dict. With that information we can construct a list of file_paths that meet the specified height and width relationship.
Example:
poster_dict = {
"id": 142840,
"posters": [
{
"aspect_ratio": 0.703125,
"file_path": "/4EFI8IdI7LOm9Q0BTT2FAdPwdeq.jpg",
"height": 2048,
"iso_639_1": "en",
"vote_average": 5.312,
"vote_count": 1,
"width": 1440,
},
{
"aspect_ratio": 0.70703125,
"file_path": "/2Lgb7oPgqVpJmruRoH7Rs2yJH0n.jpg",
"height": 2048,
"iso_639_1": "en",
"vote_average": 5.172,
"vote_count": 1,
"width": 1448,
},
{
"aspect_ratio": 0.7068881289692233,
"file_path": "/6mLaG60xEQm6mw0Ga8TDFZsk0R1.jpg",
"height": 2047,
"iso_639_1": None,
"vote_average": 0.0,
"vote_count": 0,
"width": 1447,
},
],
}
file_path_list = [
one_poster["file_path"]
for one_poster in poster_dict["posters"]
if one_poster["height"] > one_poster["width"]
]
print(file_path_list)
Output:
['/4EFI8IdI7LOm9Q0BTT2FAdPwdeq.jpg', '/2Lgb7oPgqVpJmruRoH7Rs2yJH0n.jpg', '/6mLaG60xEQm6mw0Ga8TDFZsk0R1.jpg']
As the height and width are only in the last dictionary, you can write the code as shown below :
if d['posters'][2]['height'] > d['posters'][2]['width'] :
return d['posters'][2]['file_path']
In case 'height' and 'width' are not in last dictionary, change the value of '[2]'
Hope it's helpful for you. ;-)

Docusign API - Fixed Width Setting for Text Tabs/Tags

I am using the Docusign API and trying to set the Fixed Width Flag which wraps the Text that is present in the Text Tab/Box similar to the Docusign UI when using the SandBox.. The fixed width is responsible for the text box to not exceed the document width, and it also changes a single line text box into a multi line text box once it reaches the width of the document.
How could i do this with the Docusign API?.
You can try using below JSON for Text Tab:
{
"textTabs": [
{
"tabLabel": "Sample Text",
"disableAutoSize": true,
"maxLength": 100,
"width": 134,
"height": 33,
"pageNumber": 1,
"documentId": "1",
"xPosition": 163,
"yPosition": 73
}
]
}

Azure Cognitive Services - Face API Response: Reserved Fields or Bugs?

In the Azure Cognitive Services Face API (see e.g. https://azure.microsoft.com/en-us/services/cognitive-services/face), the following response fields never seem to trigger:
headPose:pitch (reserved field)
foreheadOccluded
eyeOccluded
Am I misusing these, or is there a plan for them, or is there no plan to activate them?
If you look at the API documentation here:
For the headPose, it says:
EDIT 13/06/2019: doc was saying
HeadPose's pitch value is a reserved field and will always return 0
Now changed to:
headPose: 3-D roll/yaw/pitch angles for face direction.
For the foreheadOccluded value, I successfully got true value in the following test, where there is a cap on the head (sorry for the sample, did not find anything else quickly!):
URL: https://westeurope.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=occlusion
Content sent: { "url": "https://www.knijff.com/markmatters/wp-content/uploads/2015/10/Trump-Red-Hat.jpg" }
Reply received:
[{
"faceId": "e6ae42a6-b008-4859-9bf5-1ae22e4b71a7",
"faceRectangle": {
"top": 118,
"left": 212,
"width": 276,
"height": 276
},
"faceAttributes": {
"occlusion": {
"foreheadOccluded": true,
"eyeOccluded": false,
"mouthOccluded": false
}
}
}]
For the eyeOccluded value, I successfully got true and false values in the following test where the same person appears 2 times, one with a rectangle over the eyes:
URL: https://westeurope.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=occlusion
Content sent: { "url": "https://jov.arvojournals.org/data/Journals/JOV/933685/i1534-7362-14-13-14-f09.png" }
Reply received (please note that 1st face is the right one):
[{
"faceId": "4c2eb52e-2fd4-456c-bdae-694df1adc571",
"faceRectangle": {
"top": 204,
"left": 683,
"width": 297,
"height": 297
},
"faceAttributes": {
"occlusion": {
"foreheadOccluded": false,
"eyeOccluded": false,
"mouthOccluded": true
}
}
}, {
"faceId": "5b9dc938-e6cf-4fe9-8e6c-8649fef44e7a",
"faceRectangle": {
"top": 213,
"left": 107,
"width": 275,
"height": 275
},
"faceAttributes": {
"occlusion": {
"foreheadOccluded": false,
"eyeOccluded": true,
"mouthOccluded": false
}
}
}]

Max output size in Azure Media Encoder

Is there a built in way to prevent AME from encoding an output size from the config file if the source video is smaller than the target, or is it necessary to have a bunch of presets with each one having the maximum res then I query the media file myself to determine which preset to use?
This is what I have so far and want to include a 1080 version but don't want 720 or lower source files to generate a 1080 size:
{
"KeyFrameInterval": "00:00:02",
"H264Layers": [
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 2250,
"MaxBitrate": 3400,
"BufferWindow": "00:00:05",
"Width": 1280,
"Height": 720,
"BFrames": 3,
"ReferenceFrames": 3,
"AdaptiveBFrame": true,
"Type": "H264Layer",
"FrameRate": "0/1"
},
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 1500,
"MaxBitrate": 2250,
"BufferWindow": "00:00:05",
"Width": 960,
"Height": 540,
"BFrames": 3,
"ReferenceFrames": 3,
"AdaptiveBFrame": true,
"Type": "H264Layer",
"FrameRate": "0/1"
},
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 650,
"MaxBitrate": 1000,
"BufferWindow": "00:00:05",
"Width": 640,
"Height": 360,
"BFrames": 3,
"ReferenceFrames": 3,
"AdaptiveBFrame": true,
"Type": "H264Layer",
"FrameRate": "0/1"
}
],
"Type": "H264Video"
},
did you look into tutorials of using Media Encoder Premium Workflow encoder with Azure Media Services Workflow Designer ( https://azure.microsoft.com/en-us/documentation/articles/media-services-workflow-designer/).
There is one example of workflow which detects input resolution - https://github.com/Azure/azure-media-services-samples/tree/master/Encoding%20Presets/VoD/MediaEncoderPremiumWorkfows. (H264 Progressive Download MP4 SD). From one of example description "If source is SD (image width is less than 640), then the frame size of the output is left unchanged. Otherwise, if source is HD (image width is 640 or greater), output frame size is set to 640x360 (16:9 sources) or 640x480 (4:3 sources)."
You need to request workflow designer tool and change described logic if needed - its is hard to construct these workflow files manually.
If you want to use only Media Encoder Standard, than you need to use sdk to construct input detection logic on your side and schedule or skip encoding based on input resolution.

Is there any way to get artworks for artists/albums/songs using spotify web api? [duplicate]

There is currently no way to retrieve the cover artwork using Spotify's Web API. Are there plans to implement these or any workarounds?
June 17th 2014:
Today Spotify released a new Web API.
It is now easy to retrieve cover artwork, as all endpoints includes an array of images for every item.
Search example:
curl -X GET "https://api.spotify.com/v1/search?q=tania%20bowra&type=artist"
{
"artists" : {
...
"items" : [ {
...
"images" : [ {
"height" : 640,
"url" : "https://d3rt1990lpmkn.cloudfront.net/original/f2798ddab0c7b76dc2d270b65c4f67ddef7f6718",
"width" : 640
}, {
"height" : 300,
"url" : "https://d3rt1990lpmkn.cloudfront.net/original/b414091165ea0f4172089c2fc67bb35aa37cfc55",
"width" : 300
}, {
"height" : 64,
"url" : "https://d3rt1990lpmkn.cloudfront.net/original/8522fc78be4bf4e83fea8e67bb742e7d3dfe21b4",
"width" : 64
...
} ],
...
}
}
Old Answer:
You can get the URL to the cover art by calling Spotify's oEmbed service:
https://embed.spotify.com/oembed/?url=spotify:track:6bc5scNUVa3h76T9nvpGIH
https://embed.spotify.com/oembed/?url=spotify:album:5NCz8TTIiax2h1XTnImAQ2
https://embed.spotify.com/oembed/?url=spotify:artist:7ae4vgLLhir2MCjyhgbGOQ
With JSONP:
https://embed.spotify.com/oembed/?url=spotify:artist:7ae4vgLLhir2MCjyhgbGOQ&callback=callme
http://open.spotify.com/ urls work as well:
https://embed.spotify.com/oembed/?url=http://open.spotify.com/track/6bc5scNUVa3h76T9nvpGIH
{
"provider_url": "https:\/\/www.spotify.com",
"version": "1.0",
"thumbnail_width": 300,
"height": 380,
"thumbnail_height": 300,
"title": "Gusgus - Within You",
"width": 300,
"thumbnail_url": "https:\/\/d3rt1990lpmkn.cloudfront.net\/cover\/f15552e72e1fcf02484d94553a7e7cd98049361a",
"provider_name": "Spotify",
"type": "rich",
"html": "<iframe src=\"https:\/\/embed.spotify.com\/?uri=spotify:track:6bc5scNUVa3h76T9nvpGIH\" width=\"300\" height=\"380\" frameborder=\"0\" allowtransparency=\"true\"><\/iframe>"
}
Notice the thumbnail_url:
https://d3rt1990lpmkn.cloudfront.net/cover/f15552e72e1fcf02484d94553a7e7cd98049361a
/cover/ represents the size of the thumbnail.
Available sizes: 60, 85, 120, 140, 160, 165, 230, 300, 320, and 640.
eg: https://d3rt1990lpmkn.cloudfront.net/640/f15552e72e1fcf02484d94553a7e7cd98049361a
There are plans to implement it, as in, we want it to be there, but nobody is working on it. It is mostly a legal problem with terms of use.
Technically, it is of course possible to figure it and access the same images that for instance open.spotify.com uses by parsing html. That is not allowed of course, but there is nothing technically that stops access.
(I work at Spotify)
The iTunes and Deezer API are also useful :
http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
http://developers.deezer.com/api/search

Resources