Open DevJett opened 1 year ago
It might be tough to help in detail without having a concrete code sample of how you are doing everything. From our own samples I cannot infer how you are handling things exactly in your software when it comes to SVG rendering and printing to PDF. Let's break down your reported things:
1. Alignment of SVG These low level docs seem to be a bit outdated when it comes to the details of how to align things. In the previous releases there were some changes when it comes to the positioning of the "partials" which are rendered which is not indicated in this example correct. All partials come now with an "absolute" X/Y position at which they have to be placed.
First the partials are informed to be layout via https://alphatab.net/docs/reference/scorerenderer/partiallayoutfinished and then via renderResult
the rendering is then initiated and received via https://alphatab.net/docs/reference/scorerenderer/partialrenderfinished/. The provided X/Y positions have to be respected. The enableLazyLoading
setting might make things a bit simpler.
Depending on how you "print" the PDF, it might not be the problem of alphaTab that the alignment is not fully as expected but rather that your printing library has some expectations on the positioning of elements too.
2. Printing
The workflow of "printing" is an own big topic as such because alphaTab doesn't have at this point a capability of aligning/optimizing the output for A4 (or other page sizes). The browser version has a print
function on the API which might give some hints on managing some print optimized settings: https://github.com/CoderLine/alphaTab/blob/a708a3d8109ef53e6493e5385ff3831e189c1401/src/platform/javascript/AlphaTabApi.ts#L28-L119 It has some key parts for aligning the elements to be more suitable for printing controlled via CSS.
Again it depends on how you're doing things exactly.
If the required size of the score goes beyond the page size, alphaTab has currently no capabilities of splitting this further. alphaTab doesn't have at this point a "Page" layout like Guitar Pro. The layouts of alphaTab are rather the "Screen Vertical" and "Screen Horizontal". I checked how Guitar Pro does PDF exports in the different scenarios and they also simply have 1 page with the full music sheet on it for those layouts. The "Page" layout is more advanced.
alphaTab could likely support also a real "page" layout, but that would be a bigger new feature to add. The foundation would be there but how to then ensure the correct output in the browser or svg chunks is a separate topic again.
As alphaTab doesn't split into "pages" at this point, the only option we could offer is to show the names on every staff.
To summarize:
Is there an existing issue for this?
Current Behavior
I'm following the provided low-level APIs to generate an SVG from a Guitar Pro file that contains multiple tracks. However, the result is not as expected. It seems that all of the track bars are placed in the first SVG without any splits between them, and the names of each track are also included. This makes the first SVG too long and difficult to print, as the pages will be stacked on top of each other and become unreadable. Please take a look at the provided screenshot.
Download the Guitar Pro File I'm using here
https://files.fm/u/8w3ct5tjm
I have tested almost all version
1.3 alpha 1.2.3 1.0.1
And still the same issue.
Expected Behavior
The first SVG should be splatted into parts same as when there is no multiple tracks. Also, it would be great if you can also keep the names of each track for the rest of the bars same as the exported PDF from original Guitar Pro software.
Steps To Reproduce
Here is the source code: https://alphatab.net/docs/guides/nodejs Download GP File here: https://files.fm/u/8w3ct5tjm
Link to jsFiddle, CodePen, Project
No response
Found in Version
1.3-alpha
Platform
Node.js
Environment
Anything else?
No response