Coder Social home page Coder Social logo

johnfercher / maroto Goto Github PK

View Code? Open in Web Editor NEW
1.4K 21.0 172.0 41.14 MB

A maroto way to create PDFs. Maroto is inspired in Bootstrap and uses gofpdf. Fast and simple.

Home Page: https://maroto.io

License: MIT License

Go 99.26% Shell 0.12% Makefile 0.62%
pdf bootstrap golang fast simple grid

maroto's Introduction

Maroto V2

GoDoc Go Report Card Mentioned in Awesome Go
CI Lint Codecov Visits Badge

A Maroto way to create PDFs. Maroto is inspired in Bootstrap and uses Gofpdf. Fast and simple.

sirmaroto

Maroto definition: Brazilian expression, means an astute/clever/intelligent person. Art by @marinabankr

You can write your PDFs like you are creating a site using Bootstrap. A Row may have many Cols, and a Col may have many components. Besides that, pages will be added when content may extrapolate the useful area. You can define a header which will be added always when a new page appear, in this case, a header may have many rows, lines or tablelist.

Maroto v2.0.0-beta.16 is here! Try out:

  • Installation withgo get:
go get github.com/johnfercher/maroto/[email protected]
  • You can see the full v2 documentation here.
  • The v1 still exists in this branch, and you can see the doc here.

result

Contributing

Command Description Dependencies
make build Build project go
make test Run unit tests go
make fmt Format files gofmt, gofumpt and goimports
make lint Check files golangci-lint
make dod (Definition of Done) Format files and check files Same as make build, make test, make fmt and make lint
make install Install all dependencies go, curl and git
make examples Run all examples go
make mocks Generate mocks go and mockery
make docs Run docsify docs server local docsify
make godoc Run godoc server local godoc

Stargazers over time

Stargazers over time

maroto's People

Contributors

aleicher avatar ankur263 avatar apissurno avatar balajitechs avatar basiam avatar f-amaral avatar fernando-hub527 avatar fjogeleit avatar happsie avatar hintay avatar houseme avatar jfelipearaujo avatar johnfercher avatar kazuhirodk avatar kmpm avatar lkds avatar lynch-ai avatar manoelstilpen avatar mgorb avatar miguelbernadi avatar mxsg avatar pedrosolbm avatar pensu avatar pucklaj avatar robertocommit avatar ruzmuh avatar soulspark666 avatar stanleynguyen avatar suddengunter avatar tantatorn-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maroto's Issues

Refactor Row

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • refactor proposal
  • documentation request
  • feature request

Current behavior:
The Row method from PdfMaroto is couple between footer height calculation, footer and header execution and default execution.

Expected behavior:
We must improve the code in this part.

Related code:

maroto/pkg/pdf/pdf.go

Lines 212 to 240 in 51bcd1b

func (self *PdfMaroto) Row(height float64, closure func()) {
_, pageHeight := self.Pdf.GetPageSize()
_, top, _, bottom := self.Pdf.GetMargins()
if self.offsetY+height > pageHeight-bottom-top {
self.offsetY = 0
}
if !self.headerFooterContextActive && self.headerClosure != nil {
if self.offsetY == 0 {
self.headerFooterContextActive = true
self.headerClosure()
self.headerFooterContextActive = false
}
}
self.rowHeight = height
self.rowColCount = 0
closure()
for _, colClosure := range self.colsClosures {
colClosure()
}
self.colsClosures = nil
self.offsetY += self.rowHeight
self.Pdf.Ln(self.rowHeight)
}

Add horizontal line after every content-row added

Is your feature request related to a problem? Please describe.
Today it's not possible to have a line added after every row added from TableList. This could be useful for separating when having a lot of content.

Describe the solution you'd like
Maroto TableList should take a new property called "Line" which is a boolean. The Line should have a default size of 1.0

Describe alternatives you've considered

  • Create a new property in props.TableList called "Line".
  • Check if Line should be added on every content-row looped over.

Additional context

Fix panic when cannot found image

Describe the bug
Fix nil pointer in FileImage when cannot found image.

To Reproduce
Steps to reproduce the behavior:

  1. Use a FileImage with a wrong path to image.
  2. Maroto will panic

Related code:

m.FileImage("internal/assets/images/gopherbw.png")

Expected behavior
Maroto should return error when cannot RegisterImageOptions return nil.

maroto/internal/image.go

Lines 33 to 36 in 76210ee

info := s.pdf.RegisterImageOptions(path, gofpdf.ImageOptions{
ReadDpi: false,
ImageType: "",
})

founded in #99

Add custom page size option when creating documents

Is your feature request related to a problem? Please describe.
Currently Maroto uses only gofpdf.New to create documents with the few predefined page sizes. (A4, A5, Letter etc.)

Describe the solution you'd like
Use gofpdf.NewCustom to allow custom page sizes. Refactor NewMaroto() to accept custom width and height or create a second method for custom documents.

Auto adjust height of row inside table list

Is your feature request related to a problem? Please describe.
When the size of a text inside a column in a table list is greater than the width of the column, the text extrapolate the area.

Captura de Tela 2019-11-12 às 20 37 43

Describe the solution you'd like
The lib should adapt the height of the row and divide the text into many lines.

Describe alternatives you've considered
The text component already has a mechanism to add new lines when needed, I think we can use this feature. The only implementation we have to do is make the tablelist compute the row size.

Additional context

m.Text("TextContent", props.Text{
	Extrapolate: false
})

Support to create/add an image from raw `[]byte`

Is your feature request related to a problem? Please describe.

Image is already (generated and) stored in memory as []byte. Do I need to convert it to base64, or save to file, before add the image to pdf document?

Describe the solution you'd like

There should be support for creation of image from []byte or, (maybe?) more generic way:

type ByteProvider interface {
    Get() []byte
}

Describe alternatives you've considered
Converting to base64, or saving to file. However,.. image is binary data, and []byte seems like the most relevant data type to represent image raw data (as base64 conversion takes some time).

Add accessor to gofpdf

Is your feature request related to a problem? Please describe.

The simplicity of the maroto solution is very powerful but sometimes it would be useful to be able to access gofpdf if we wish to do something lower level, i.e. change orientation of a new page etc. What side affects might this cause?

Describe the solution you'd like

A documented method of accessing gofpdf. Understand you can "cast" Maroto to PdfMaroto:

m := pdf.NewMaroto(consts.Portrait, consts.A4)
var pM = m.(*pdf.PdfMaroto)
pM.Pdf.AddPage()

But would there be a "safer" way to do this?

Describe alternatives you've considered

Could obviously fork and add needed functionality to do each thing, i.e. add new page with different orientation etc

Is there an option to change the text color?

Hi!

first of all, I really like the concept of library. But is there a way to change the color of text? I don't see any option in the props.Text and all the examples only use a black font.

Add support to use TrueType UTF-8 encoded fonts

Is your feature request related to a problem? Please describe.

Need to produce documents using ttf fonts to match required brand guidelines.

Describe the solution you'd like

Ability to add TrueType UTF-8 encoded fonts and refer to it at different points throughout production of document.

Describe alternatives you've considered

Use gofpdf directly if it were exposed.

Improve text component

Describe the solution you'd like
Use markdown syntax to improve text styling, like:

Describe alternatives you've considered
Interpret that *text* should be italic.
Interpret that **text** should be bold;
Interpret that ***text*** should be bold and italic;
Interpret that \n should break a line in text;

Additional context
If this be implemented, I think that props.Text and props.Font shouldn't have the style parameter anymore.

maroto/pkg/props/prop.go

Lines 44 to 59 in 008f53d

// Text represents properties from a Text inside a cell
type Text struct {
// Top is space between the upper cell limit to the barcode, if align is not center
Top float64
// Family of the text, ex: consts.Arial, helvetica and etc
Family consts.Family
// Style of the text, ex: consts.Normal, bold and etc
Style consts.Style
// Size of the text
Size float64
// Align of the text
Align consts.Align
// Extrapolate define if the text will automatically add a new line when
// text reach the right cell boundary
Extrapolate bool
}

maroto/pkg/props/prop.go

Lines 61 to 69 in 008f53d

// Font represents properties from a text
type Font struct {
// Family of the text, ex: consts.Arial, helvetica and etc
Family consts.Family
// Style of the text, ex: consts.Normal, bold and etc
Style consts.Style
// Size of the text
Size float64
}

Cannot define an uncentralized Barcode

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • feature request

Current behavior:
There is no implementation of uncentralized Barcode.

Expected behavior:
We should have uncentralized Barcode.

Steps to reproduce:
If you pass a prop forcing uncentralized , it will centralize the barcode anyway.

Related code:

maroto/pkg/pdf/pdf.go

Lines 352 to 356 in 51bcd1b

if barcodeProp.Center {
err = self.Code.AddBar(code, sumOfyOffsets, self.rowColCount, qtdCols, self.rowHeight, barcodeProp.Percent, barcodeProp.Proportion.Height/barcodeProp.Proportion.Width)
} else {
err = self.Code.AddBar(code, sumOfyOffsets, self.rowColCount, qtdCols, self.rowHeight, barcodeProp.Percent, barcodeProp.Proportion.Height/barcodeProp.Proportion.Width)
}

RegisterFooter

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • feature request

Current behavior:
There is no register footer

Expected behavior:
Should have a register footer. RegisterFooter should receive an closure which will be executed always before add a new page.

Improve testability

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • feature request

Current behavior:
Nowadays the users must use some lib like Mockery to mock the maroto behavior. The problem is that the automatic methods doesn't provide support to recursive assertions, and this limits the development.

Expected behavior:
Maroto must provide a mock which allow the assertion of method inside a closure.

QrCode example

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • documentation request
  • feature request

Other information:

  • There is no example of how to use QrCode, we must add one in pkg/pdf/example_test.go

Image for Background

Is your feature request related to a problem? Please describe.
I suggest about using image for background. It will help instead using color.

Describe the solution you'd like
Not yet, just suggest.

Describe alternatives you've considered
Maybe could make a prop that can use for backwards the image or just make func to set background from image

Additional context
not have

Migrate to Go 1.13 in travis tests

Is your feature request related to a problem? Please describe.
2 months as it's out, I think we should adopt it and run all tests against this version so library users had no issues with newer version of Go.

Describe the solution you'd like
change line with Go version in travis.yml

Describe alternatives you've considered
do not migrate, but I see no issues why don't.

Can't push code to new branch

Hello, Im trying to make contribution to this great repository but only get the following error:

ERROR: Permission to johnfercher/maroto.git denied to Jepzter.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What do I have to do to contribute?

FileImage() and other I/O functions should handle errors

Hello,

Maroto has a certain number of functions that wrap I/O operations, such as FileImage(filePathName string, prop ...props.Rect), that do not return an error.

If an error happens (simplest example: the path doesn't exist), Maroto internal state will sooner or later cause a crash (see for example #98).

I understand that gofpdf "delays" errors, but it does so in a way to keep the internal state crash-proof. Maroto should do the same.

thanks!

All 3 examples broken (panic: runtime error: invalid memory address or nil pointer dereference)

Hello,

the 3 examples expect to be run from the root directory of the maroto repository. If they are run in another directory, they crash.

For example:

$ pwd
maroto/bin

$ ./sample1
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb0 pc=0x11d4d5d]
goroutine 1 [running]:
github.com/jung-kurt/gofpdf.(*ImageInfoType).Width(...)
	/Users/mmolteni/sync/src/go/pkg/mod/github.com/jung-kurt/[email protected]/def.go:248
...

The simplest possible fix is not to ignore errors :-). For example:

 func main() {
    m := pdf.NewMaroto(consts.Portrait, consts.A4)
    //m.SetBorder(true)

-   byteSlices, _ := ioutil.ReadFile("internal/assets/images/biplane.jpg")
+   byteSlices, err := ioutil.ReadFile("internal/assets/images/biplane.jpg")
+   if err != nil {
+       fmt.Println("Got error while opening file:", err)
+       os.Exit(1)
+   }

Unicode support is not working properly

Describe the bug

When trying to create texts with kirillic letters the output pdf is not showing them. Dots are shown instead
To Reproduce
Steps to reproduce the behavior:

  1. build and execute app.go
    2.The file will look as attached
    Related code:
    app.txt
    somepdf.pdf
	m.Row(40, func() {
		m.Col(4, func() {
			_ = m.FileImage("D:\\work\\1c\\1c_processors\\go_dev\\123.jpg", props.Rect{
				Center:  true,
				Percent: 80,
			})
		})
		m.Col(4, func() {
			m.Text("Арнидог", props.Text{
				Top:         12,
				Size:        20,
				Extrapolate: true,

			})
			m.Text("очень странные символики", props.Text{
				Size: 12,
				Top:  22,
			})
		})
		m.ColSpace(4)
	})

Expected behavior
resulting pdf should show kirillic symbols

Stacktrace

Additional details (please complete the following information):

  • OS: windows 10 home edition

  • Python Version [e.g. 3.5, 3.6] n/a

  • HEAD Commit hash [e.g. 4629c62]

Additional context

gofmt everything!

I believe that in Go community gofmt is like a standard for code formatting. I've tried to fix code in my PR by gofmt and - ohh, lot's of code in repo was formatted by it. I've discarded those changes because they was unrelated to my PR - but I still encourage you to format code in repo.

Describe the solution you'd like
1 add gofmt -l -s -w . (or even better - goimports) as a requirement for all code that pushed to repo.
2 make PR that formats all code in repo

Describe alternatives you've considered
goimports is even better because it sorts imports. mb also add some linter/static analyzer etc

Add a custom page break command

Is your feature request related to a problem? Please describe.
We face the problem, that we need to create a new page in the pdf before the actual page is full. So we need a custom page break command.

Describe the solution you'd like
It would be great to be able to tell maroto via command or method call to add a page break at the current position and all content added after the call will be added to a new page.

Describe alternatives you've considered
There are no alternatives, as maroto is the only pdf tool i found not using x/y coordinates.

Additional context
Maroto is based on/uses gofpdf in the background which allows custom page breaks via the .AddPage() method.

Add support to change orientation of pages

Is your feature request related to a problem? Please describe.

Pages like a cover and copyright could likely be aligned as portrait while data heavy tables may suit being added on a landscape page.

Describe the solution you'd like

I see there is an issue already raised to add a new page/page break. It would be useful if this were updated with optional field to indicate orientation.

Describe alternatives you've considered

Cannot define an uncentralized FileImage

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • feature request

Current behavior:
There is no implementation of uncentralized FileImage.

Expected behavior:
We should have uncentralized FileImage.

Steps to reproduce:
If you pass a prop forcing uncentralized , it will centralize the barcode anyway.

Related code:

maroto/pkg/pdf/pdf.go

Lines 300 to 304 in 51bcd1b

if rectProp.Center {
self.Image.AddFromFile(filePathName, sumOfyOffsets, self.rowColCount, qtdCols, self.rowHeight, rectProp.Percent)
} else {
self.Image.AddFromFile(filePathName, sumOfyOffsets, self.rowColCount, qtdCols, self.rowHeight, rectProp.Percent)
}

Migrate from dep to Go module system

Is your feature request related to a problem? Please describe.
Go's module system, introduced in Go 1.11, is the official dependency management solution built into the go command.

Broken git tag for 0.15.4

Hello,

the tag should be v0.15.4 but actually is v.0.15.4 (there is a spurious . between v and 0) :-)

I found this by using go mod in my own project.

Change tablelist borders style

Describe the solution you'd like
I would like to change tablelist border color, for example by using a RGB or RGBA code. As far as I know, it's only possible to show or hide borders.

It does not support Chinese and Arabic characters.

I needed to create a document in pdf format with texts in different languages ​​(Chinese, Arabic). Although the Text component uses func (_m *Pdf) UnicodeTranslatorFromDescriptor(cpStr string) func(string) string function, it does not support Chinese or Arabic symbols, and converts them to points in the document created.

image

image

Repeat TableList heading on new page when list exceeds page bottom margin

Is your feature request related to a problem? Please describe.
For long lists, the TableList header be visible again to make the list more readable and not having to jump to the top of the page to see what column titles that was defined.

Describe the solution you'd like

Check if the next row will break page margin and if that's true generate the TableList header again.

Describe alternatives you've considered

Add RegisterFooter to diagram image

Maroto version:

I'm submitting a ...

  • bug report
  • refactor proposal
  • documentation request
  • config proposal
  • feature request

Current behavior:
The current diagram Image doesn't have a RegisterFooter at same level as RegisterHeader.

Expected behavior:
We should add to the diagram to show that is possible use a RegisterFooter like the RegisterHeader.

Related code:
https://github.com/johnfercher/maroto/blob/master/internal/assets/images/diagram.png

Other information:
The current Image was generated with https://www.draw.io/?libs=general

Barcode example

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • documentation request
  • feature request

Other information:

  • There is no example of how to use Barcode, we must add one in pkg/pdf/example_test.go

Define column widths on both Col and TableList component

Is your feature request related to a problem? Please describe.
I think you should have the possibility to change the width of the columns, especially in the TableList component. When you many column in the list, some may just contain one character and some might have a lot of information. It makes no sense that the column with one character should take as big of a space like the one with a lot of information and get cropped to a new line. Instead we should be able to manage this a bit to free up more space for the ones needed.

Describe the solution you'd like
Maroto should be able to specify not only height, but also width like so:
m.Col(20,19, func() {})

The TableList should maybe have a slice of float64 in the TableProps defining each columns width.

Describe alternatives you've considered
Add additional but optional extra parameter / rewrite to a struct for the Col component to take in.
Add extra struct field called ColSizes that is of type []float64 that holds the size of the columns.

Update issue templates

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • feature request
  • config request

Current behavior:
The current issue_template.md is the old version.

Expected behavior:
The project should update to the new version.

Set background color

Hi,
I'm trying to find how I can set the background color for the col or row. Is that feature already covered?

Thanks

Be able to specify more font options for TableList

Is your feature request related to a problem? Please describe.
If you have a filled header row, then it would be beneficial to be able to specify colour for the text being used in particular when this would differ from the how you want the font colour to appear for the contents of the other rows.

Describe the solution you'd like
Update TableListContent to have a new color.Color field and have that be acted on when it is specified during the drawing of text.

Describe alternatives you've considered
None that appear obvious to me.

Additional context

Cannot define an uncentralized Base64Image

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • feature request

Current behavior:
There is no implementation of uncentralized Base64Image.

Expected behavior:
We should have uncentralized Base64Image.

Steps to reproduce:
If you pass a prop forcing uncentralized , it will centralize the barcode anyway.

Related code:

maroto/pkg/pdf/pdf.go

Lines 320 to 324 in 51bcd1b

if rectProp.Center {
self.Image.AddFromBase64(base64, sumOfyOffsets, self.rowColCount, qtdCols, self.rowHeight, rectProp.Percent, extension)
} else {
self.Image.AddFromBase64(base64, sumOfyOffsets, self.rowColCount, qtdCols, self.rowHeight, rectProp.Percent, extension)
}

RegisterHeader example

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • documentation request
  • feature request

Other information:

  • There is no example of how to use RegisterHeader, we must add one in pkg/pdf/example_test.go

Cannot define an uncentralized QrCode

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • feature request

Current behavior:
There is no implementation of uncentralized QrCode..

Expected behavior:
We should have uncentralized QrCode.

Steps to reproduce:
If you pass a prop forcing uncentralized, it will centralize the barcode anyway.

Related code:

maroto/pkg/pdf/pdf.go

Lines 373 to 377 in 51bcd1b

if rectProp.Center {
self.Code.AddQr(code, sumOfyOffsets, self.rowColCount, qtdCols, self.rowHeight, rectProp.Percent)
} else {
self.Code.AddQr(code, sumOfyOffsets, self.rowColCount, qtdCols, self.rowHeight, rectProp.Percent)
}

Output() don't work

Output() function don't work, I can't use it.

Related code:

        // code

        buff, err := m.Output()
	if err != nil {
		fmt.Println("Could not save PDF:", err)
		os.Exit(1)
	}

	fmt.Println(buff.Cap(), buff.Len(), len(buff.String()))

Return: 0 0 0

With OutputFileAndClose(..) only works.

AlternatedBackground doesn't work with custom top margin

Describe the bug
When defined a custom top page margin, the alternated background doesn't consider the new value in the y offset and doesn't fill the background correctly. This is a limitation from CellFormat.

Related code:

m := pdf.NewMaroto(consts.Portrait, consts.A4)
m.SetPageMargins(10, 15, 10)

m.TableList(headerSmall, smallContent, props.TableList{
	AlternatedBackground: &color.Color{
		Red:   200,
		Green: 200,
		Blue:  200,
	},
})

Expected behavior

  • The alternated background should fill the background correctly, considering the new top margin.

RegisterFooter example

Maroto version:
Latest

I'm submitting a ...

  • bug report
  • documentation request
  • feature request

Other information:

  • There is no example of how to use RegisterFooter, we must add one in pkg/pdf/example_test.go

Text alignment behaves strangely

Firstly, I just want to say this is a very cool/useful project :)

I'm trying to build a PDF quote. As part of that I've got a table and some of the items in the table are numbers (others are normal text). The numbers should ideally align to the right.

With debugging turned on and text on the cells set to "Left" on the "Amount" column :
Screenshot from 2019-07-19 17-47-28

With debugging turned on and text on the cells set to "Right" on the "Amount" column:
Screenshot from 2019-07-19 17-49-11

Header creation code :

			style := maroto.Bold
			m.Row(0, func() {
				m.Col(func() {
					m.Text("Description", &maroto.TextProp{
						Size:  11,
						Style: style,
						Align: maroto.Left,
					})
				})
				m.Col(func() {
					m.Text("", &maroto.TextProp{
						Size:  11,
						Style: style,
						Align: maroto.Left,
					})
				})
				m.Col(func() {
					m.Text("Quantity", &maroto.TextProp{
						Size:  11,
						Style: style,
						Align: maroto.Right,
					})
				})
				m.Col(func() {
					m.Text("Rate", &maroto.TextProp{
						Size:  11,
						Style: style,
						Align: maroto.Right,
					})
				})
				m.Col(func() {
					m.Text("Amount", &maroto.TextProp{
						Size:  11,
						Style: style,
						Align: maroto.Right,
					})
				})
			})

			m.Line(4.0)
			m.Row(2, func() {

			})

and row creation code

for _, j := range cc.ExpandedContent {
				m.Row(4, func() {
					m.Col(func() {
						m.Text(j.Item, &maroto.TextProp{
							Size:  size,
							Style: style,
							Align: maroto.Left,
						})
					})
					m.Col(func() {
						if j.Info != "Yes" {
							m.Text(j.Info, &maroto.TextProp{
								Size:  size,
								Style: style,
								Align: maroto.Left,
							})
						}
					})
					m.Col(func() {
						m.Text(strconv.FormatFloat(float64(j.Qty), 'f', 2, 64), &maroto.TextProp{
							Size:  size,
							Style: style,
							Align: maroto.Right,
						})
					})
					m.Col(func() {
						m.Text(formatCurrency(j.Rate), &maroto.TextProp{
							Size:  size,
							Style: style,
							Align: maroto.Right,
						})
					})
					m.Col(func() {
						m.Text(formatCurrency(j.Rate), &maroto.TextProp{
							Size:  size,
							Style: style,
							Align: maroto.Right,
						})
					})
				})
}

With debugging turned off :
Screenshot from 2019-07-19 17-56-41

Allow to define different margins

Is your feature request related to a problem? Please describe.
Today is not possible to defined different values of margins in the PDFs generated by maroto.

Describe the solution you'd like
Maroto should allow the configuration of these parameters.

Describe alternatives you've considered

  • Create a SetMargins method to define new values inside the gofpdf
  • Create a GetMargins to allow to test if these values were set.

Additional context

Change barcode constraint proportions

Describe the bug
We should defined better proportion constraints in the Barcode creation.

To Reproduce
Steps to reproduce the behavior:

  1. Define a barcode with proportion like 16x9 or 4x3
  2. It will not be applied

Related code:

maroto/pkg/props/prop.go

Lines 138 to 140 in 76210ee

if r.Proportion.Height > r.Proportion.Width*0.33 {
r.Proportion.Height = r.Proportion.Width * 0.33
}

Expected behavior
We should change this constraint to enable better proportions, like: 16x9, 4x3 and so on.

Additional context
Discovered in #94

Bad Layout on Table List with long text

First of all, I like this maroto! Kudos! I'm trying to use it to generate an small pdf of a list and the TableList component looks like a good fit. Although I'm having an odd layout and some of the pages does not even have the registered header, the footer also is not at the bottom of pages.

To Reproduce
Try to run the following code: https://gist.github.com/nmorenor/78f0cf3f92e4e22a61ae147deb1357eb

Expected behavior
PDF produced, all pages should have a header and footer, when the height of the table list row element is greater than the page size, content go to the next page.

Double Column

Is your feature request related to a problem? Please describe.

  • Nowadays is not possible to have two table lists (or custom lists) side by side, so in some cases will be a huge waste of useful space in the PDF.

Describe the solution you'd like
Maybe will be possible to create a DoubleColumn configuration that will execute all the calculation to create the PDF respecting the grid constraints, but we will execute two times, the first time the grid will work from from 0 to the width/2 and in the second time the frid will work from width/2 to width.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.