#!/usr/bin/env perl use v5.24; use strict; use warnings; use autodie qw( :all ); use LWP::UserAgent; use Mojo::DOM; use Path::Tiny qw( tempfile ); my $uri = shift // 'https://houseabsolute.com/resume/'; my $ua = LWP::UserAgent->new; # If we use the default agent it looks like render returns a 403 :( $ua->agent('resume-pdf/1.0'); my $response = $ua->get($uri); unless ( $response->is_success ) { my $msg = 'Got ' . $response->code . " from $uri"; my $content = $response->decoded_content; $msg .= "\n$content\n" if $content; die $msg; } my $html = $response->decoded_content; my $dom = Mojo::DOM->new($html); my $content = $dom->find('article')->first; $dom->find('.web-only')->each( sub { $_->remove } ); $dom->find('h1')->first->remove; my $head = sprintf( <<'EOF', $uri, $uri );

Dave Rolsky

dave@urth.org
612-555-1234

The most up to date version of my resume can always be found online at
%s.


EOF my $clean = $head . $content->children->join("\n"); $clean =~ s{ ]+class="fab fa-github"[^>]*>}{}; my $t = tempfile(); $t->spew_utf8($clean); my $target = '/home/autarch/misc/job/resume.pdf'; my @vars = ( '-V', 'pagesize:letter', '-V', 'linkcolor:Blue', ( map { ( '-V', 'margin-' . $_ . ':1.0in' ) } qw( top bottom left right ) ), ); system( 'pandoc', $t, @vars, qw( -f html -t latex -o ), $target ); system( 'xdg-open', $target ); __END__ Copyright © 2022 David Rolsky Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.